yashsingh1/xdaforums huggingface dataset:
[Google Pixel 2 XL ROMs, Kernels, Recoveries, & Oth] sruel3216:
Sorry, first time using. How do I check output and magisk log?

I just have kcal and vibration set on boot

Oh I think I might have forgot to set permissions. I'll try again soon
[Google Pixel 2 XL ROMs, Kernels, Recoveries, & Oth] Juzman:
I think I found it in another post that xFirefly had in the script. :)
[Google Pixel 2 XL ROMs, Kernels, Recoveries, & Oth] pkgnex:
The script creates a file "pks script result" in /storage/emulated/0 (base storage directory). Open it and see if it says "successfully executed". If it is there and was successful, then open magisk manager, go into logs, select the magisk logs tab, and see if after "late start service running" it lists the script name.

If all the above checks out, then the script is running and something else is overwriting what it sets.

If something above doesn't check out, let me know what and I can help try to debug it.
[Google Pixel 2 XL ROMs, Kernels, Recoveries, & Oth] sruel3216:
Ok it's running. I forgot to set permissions first time. Thanks! I'll try it out for a bit.
[Google Pixel 2 XL ROMs, Kernels, Recoveries, & Oth] pkgnex:
Just glad you got it figured out!
[Google Pixel 2 XL ROMs, Kernels, Recoveries, & Oth] sruel3216:
Disabling fsync and gpu boost set to low won't conflict your script?
[Google Pixel 2 XL ROMs, Kernels, Recoveries, & Oth] pkgnex:
Shouldn't. It never did before for me.

However, the EX update is acting weird for me... Things aren't staying anymore.
[Google Pixel 2 XL ROMs, Kernels, Recoveries, & Oth] sruel3216:
I think you have to allow it to run in background now. He said the app was having problems when it was battery optimized
[Google Pixel 2 XL ROMs, Kernels, Recoveries, & Oth] pkgnex:
You're right! Once I stopped hitting deny, all is now well.

Thanks!
[Google Pixel 2 XL ROMs, Kernels, Recoveries, & Oth] Schroeder09:
Are swap and zram the same thing? I thought they were. Your script is running according to the magisk log and when I set the IO scheduler to schedulit after boot up and wait ex kernel manager confirms that the IO s heduler changes to noop. However, the ram truth app shows that my swap is back on. I have gone through all the menus in the ex kernel manager and disabled everything that was it to apply on boot. I also disabled the swap torpedo magisk module in case it was causing any conflict with your script. Ram truth still shows 512Mb of swap though.

Can everything your script does (or a lot of it) just be adjusted and set in the ex kernel manager? Maybe I'll just do that since I'm having such a hard time getting this to turn swap off.

Ex kernel manager has a script manager in it. Should this script be placed in there?
[Google Pixel 2 XL ROMs, Kernels, Recoveries, & Oth] pkgnex:
You could certainly try putting the script in EX and let me know if it works! I'm sorry you're having so much trouble with this, it is perplexing me and I wish I could have already helped more.

As far as your other questions, zram is a type of swap. I even downloaded the ramtruth app to see if I had the same problem as you, but it says 0 swap for me, so the app isn't the problem.

Some of the stuff from my script can be set in EX, some can't.

Possible things you can try:

1. Open the script and change the "sleep 60" to "sleep 100" save, it, reboot, see if swap is off. It could be if you have modules, themes, lots of background apps, or EX is doing a lot at boot that delaying the script will get it to work. This has helped at least troubleshoot some issues in the past.

2. Open the script and delete the 3 lines of code related to swap / zram, save, reboot, and see if swap is off. If not, I think turning zram off is something that can be done in EX.

If you need me to, I can give you test files for these scenarios tomorrow, but you should just be able to open and edit it with whatever file manager you are using.
[Google Pixel 2 XL ROMs, Kernels, Recoveries, & Oth] ranasrule:
This is weird. I'm on stock Oreo 8.1, Flash kernel and Magisk 17.1 and there isn't even a Magisk folder in my root folder :confused::confused::confused:

I know Magisk is installed and working as all the modules are working and Magisk Manager says everything is ok.
[Google Pixel 2 XL ROMs, Kernels, Recoveries, & Oth] Badger50:
Are you meaning the MagiskManager root folder, or the one you find in the sbin folder?
[Google Pixel 2 XL ROMs, Kernels, Recoveries, & Oth] pkgnex:
The root/magisk folder went away many months ago.

As [MENTION=3730810]Badger50[/MENTION] stated, you're now looking in /sbin...
[Google Pixel 2 XL ROMs, Kernels, Recoveries, & Oth] sruel3216:
I must say this is running real nice with EX kernel. Apps def open faster. Great job
[Google Pixel 2 XL ROMs, Kernels, Recoveries, & Oth] pkgnex:
Thanks!
[Google Pixel 2 XL ROMs, Kernels, Recoveries, & Oth] pkgnex:
New Version!

Updated!

94pks16 is released.

File in OP, change log in 2nd post, repeated here:

- Revert dir-notify-disable

- Fix a minor dirty-expire vm derp I made many, many releases ago

- Adjust dev/stune/schedtune parameters to ensure users won't have frequency scaling issues on any kernel, allowing cpu's to actually settle and sleep. This wasn't likely before, but is now virtually impossible, while performance improvement during app switching is still present!

Enjoy!
[Google Pixel 2 XL ROMs, Kernels, Recoveries, & Oth] sruel3216:
Thanks. Testing now

---------- Post added at 04:28 AM ---------- Previous post was at 04:23 AM ----------

Looks to be running great. No scaling issue
[Google Pixel 2 XL ROMs, Kernels, Recoveries, & Oth] sublimaze:
94pks16 is running great on latest Sultan Kernel. Apps and UI are snappy, no lag or jank, and amazing battery life :good:
[Google Pixel 2 XL ROMs, Kernels, Recoveries, & Oth] pkgnex:
Thanks for the report!
[Google Pixel 2 XL ROMs, Kernels, Recoveries, & Oth] jordi.id96:
Thanks a lot for your script. It works very well alongside ElementalX, everything feels very very smooth compared to stock.

The only downside is that RAM usage has increased a lot, leaving only about 500-400Mb of free memory. Apps close in the background in a matter of minutes and only the latest three or so are kept open in memory. Before aplying your script, I had like half of the RAM free and I could go back to apps launched hours ago that were still open and running. I think it might have to do with zram being disabled or a low value for swappiness, I've experimented with that in the past and I got the same behavior. I'll try tweaking your scrip and I'll report back.

Thanks again for your work!
[Google Pixel 2 XL ROMs, Kernels, Recoveries, & Oth] pkgnex:
No problem, and I'm glad the script is mostly working for you.

You're likely correct about the RAM and recent apps. Turning zram back on might fix your issues. Failing that, also comment out the swappiness line.

I don't experience those issues personally, but I usually don't leave apps open on my phone for hours and when I do, I live with the refresh time if there is any because not having zram on reduces latency in my usual usage.

Let me know what you find, though. You really shouldn't need zram on a device with 4 Gb of physical RAM!
[Google Pixel 2 XL ROMs, Kernels, Recoveries, & Oth] jordi.id96:
Yeah, I know 4Gb is more than enough, but disabling zram triggers that behavior even if it shouldn't.

I just re-enabled zram and I have 60% of free RAM, even with 0% zram usage, just by enabling it. I think the key is to keep zram enabled but give it minimum space, like 128Mb. Also I don't notice the extra latency, so for my usage this is perfect.

Swapiness still at 5, that works well.

I hope this is helpful for other people having the same issue
[Google Pixel 2 XL ROMs, Kernels, Recoveries, & Oth] pkgnex:
Thanks for reporting back.

I'll see if I can make an adjustment that would make everyone happy in a future release.

Interestingly, I just rebooted and the available RAM went UP when the script executed after 60 seconds.? This makes no sense since 512 Mb of RAM was taken away. I've also noticed that after a reboot, my RAM can vary by 500 Mb either with or without the script... I think there is a huge variance in the memory utilized from boot to boot, and I've only noticed this on Pie...
[Google Pixel 2 XL ROMs, Kernels, Recoveries, & Oth] sruel3216:
Yeah I wish there was a way to keep apps in memory longer. Pixel just sucks at it with or without your script. My messages app reloads constantly even after a few min of not using and only that app open. Most the Google apps don't stay in memory for me. It's very annoying
[Google Pixel 2 XL ROMs, Kernels, Recoveries, & Oth] pkgnex:
New Version!

Updated!

94pks17 is released with further performance increases.

File in OP, change log in 2nd post.

Enjoy!
[Google Pixel 2 XL ROMs, Kernels, Recoveries, & Oth] Schroeder09:
I thought it was just me who had this problem. Nothing seems to stay in the memory for long and I was wondering if it was because I have too many mods or something on my phone but I always thought my mods were modest.

Anyway, v16 seems to have given me high idle drain so I'm gonna try not using for a couple days to confirm.
[Google Pixel 2 XL ROMs, Kernels, Recoveries, & Oth] pkgnex:
Happens to everyone, even on stock.

Try v17.

After 5 1/2 hours sot, I still have over 1/3 of my battery left. If you're not getting similar performance, it's an app you're running, not the script!
[Google Pixel 2 XL ROMs, Kernels, Recoveries, & Oth] sruel3216:
This runs fast. Very fast. ?
[Google Pixel 2 XL ROMs, Kernels, Recoveries, & Oth] pkgnex:
Yes.

Yes it does!

;)
[Google Pixel 2 XL ROMs, Kernels, Recoveries, & Oth] ho0o0o11111:
Tried the latest version 2 days. No problem found, the phone is very fluid and responses very fast. Extremely fast.

No obvious extra battery consumption too.

Thanks a lot.
[Google Pixel 2 XL ROMs, Kernels, Recoveries, & Oth] sruel3216:
Phone is running so good and battery is amazing. I don't want to update to October cuz I don't wanna mess with anything lol.
[Google Pixel 2 XL ROMs, Kernels, Recoveries, & Oth] pkgnex:
Thanks for the feedback!

I hear you... but I'm sure it will be fine!
[Google Pixel 2 XL ROMs, Kernels, Recoveries, & Oth] sruel3216:
I did lol. Fast as ever!
[Google Pixel 2 XL ROMs, Kernels, Recoveries, & Oth] pkgnex:
New Version!

Updated!

94pks18 is released with a substantial battery life improvement with no perceptible performance hit.

File in OP, change log in 2nd post.

Enjoy!

P.S. Stay tuned... I'm planning to ask some users to do some beta testing on an item or two in the near future!
[Google Pixel 2 XL ROMs, Kernels, Recoveries, & Oth] sruel3216:
Thank you! Will test now

Edit: running smooth. Will report battery in a couple cycles
[Google Pixel 2 XL ROMs, Kernels, Recoveries, & Oth] pkgnex:
To be clear, it is primarily active drain that will be reduced, more so than idle drain.
[Google Pixel 2 XL ROMs, Kernels, Recoveries, & Oth] sruel3216:
That's great since idle is already amazing
[Google Pixel 2 XL ROMs, Kernels, Recoveries, & Oth] pkgnex:
New Version!

Updated!

94pks19 is released with faster loading, some network speed improvements verified through testing, and adding a wakelock blocker (thanks to [MENTION=8852292]xFirefly93[/MENTION] for the find) that gets rid of only wakelocks BBS found on my Pixel 2 XL that are also confirmed safe to block.

File in OP, change log in 2nd post.

Enjoy!
[Google Pixel 2 XL ROMs, Kernels, Recoveries, & Oth] pkgnex:
Notes on Compatibility

Since some have asked in this thread, via PM, or in [MENTION=8852292]xFirefly93[/MENTION]'s thread, here are some notes on kernel and script compatibility:

1. The PK script is the same for all Pixel 2 / Pixel 2 XL kernels. I do not turn knobs that are specific to any given kernel. It works on all of them!

2. The PK script is slightly more performance oriented than xFirefly93's, but we do share some things - he's taken some things from me that help one aspect without harming the other, and I have done the same from his excellent work.

3. The PK script and xFirefly93's are compatible! Due to the way they are named, if you place both scripts in service.d, his will run first, then mine will. This actually works quite well because you get all of the kernel module, GPU, and wakelock stuff he has done mostly for battery saving, and then you get a slightly more performance-oriented tune from my script for the things the two scripts have in common or that I have added.

Note also that I have no immediate plans to disable all the kernel modules and wakelocks that xFirefly93 has, so running both of our scripts in conjunction will be the only way to take advantage of both of our efforts should you desire to do so.
[Google Pixel 2 XL ROMs, Kernels, Recoveries, & Oth] xFirefly93:
Its you, and your inspirational work, that made me take the step into this deep territory and start working on this kind of stuff, which not even 2 months later (after the initial release of my script / kernel configuration) already have over 14k viewers.

You are the one around here that deserves a big thank you, and a ice cold beer, if anyone. Literally.

:highfive:
[Google Pixel 2 XL ROMs, Kernels, Recoveries, & Oth] pkgnex:
I'm glad to have had a hand in your inspiration, but you've made your own road and you're doing great!

:victory:
[Google Pixel 2 XL ROMs, Kernels, Recoveries, & Oth] dijeypee:
I need help :( does this mean it worked or it failed? It says mount namespace not supported in your kernel. :(
[Google Pixel 2 XL ROMs, Kernels, Recoveries, & Oth] xFirefly93:
1) This is not a kernel, and..

2) Have you tried with downloading the Busybox for Android NDK Magisk module?
[Google Pixel 2 XL ROMs, Kernels, Recoveries, & Oth] pkgnex:
Adding to what xFirefly93 stated, is there a file named pks_script_result in the base directory of your internal storage? If so, when you open it, what does it say?

It does appear that your BusyBox installation is missing or not working. What kernel are you using, and have you installed the magisk BusyBox module?
[Google Pixel 2 XL ROMs, Kernels, Recoveries, & Oth] xFirefly93:
On top of that, just for clarify things a little..

Busybox is literally a must-have for the mounting and TRIM tweaks, otherwise they aren't working at all.

Ping [MENTION=6447847]dijeypee[/MENTION].
[Google Pixel 2 XL ROMs, Kernels, Recoveries, & Oth] dijeypee:
I just installed busybox free on playstore and the busybox magisk module.

YES there is a pks_script_result in the base directory :)

Also, is it okay to run this with ram management module? Sorry i keep on asking. ?
[Google Pixel 2 XL ROMs, Kernels, Recoveries, & Oth] xFirefly93:
You don't need the Busybox app if you have installed the Busybox Magisk module.

Which RAM managment module do you mean btw? :)
[Google Pixel 2 XL ROMs, Kernels, Recoveries, & Oth] pkgnex:
As xFirefly93 stated, you only need the magisk busybox module.

If the script output is there, magisk ran it!

It looks like the (by crok) ram management module will set many of the vm settings that would then be changed by my script (or xFirefly93's) when they execute 30 seconds after boot. You can try running both and see, but I think most of the RAM module will be overwritten by the PK script so it's probably of limited benefit.
[Google Pixel 2 XL ROMs, Kernels, Recoveries, & Oth] dijeypee:
Im using the one by crok. I uninstalled it just now. Read the changes and i guess it does really little diff because it somewhat collides with your settings. Just one question. The min gpu frequency is set to 332 but the max gpu is set to 0?

And what should i do with external i/o sched? Should it be on cfq or nooq? Thank so much for your help btw. I noticed that my mate 10 got a massive improvement. It doesn't heat up as much as before, its more snappier, and the battery life got extended from 2-3½ to 4-5hrs sot. ?

I Still have a lot to learn tho. Hehe need more tweaking and more asking for help haha
[Google Pixel 2 XL ROMs, Kernels, Recoveries, & Oth] xFirefly93:
Which device are you using..?
[Google Pixel 2 XL ROMs, Kernels, Recoveries, & Oth] dijeypee:
I am not sure. But i thinks its from openkirin?
[Google Pixel 2 XL ROMs, Kernels, Recoveries, & Oth] pkgnex:
You're in the wrong thread for your device... There are some Pixel 2 specific items in the script that should probably not be applied on another device like your Mate 10.

You should immediately remove my script and reboot your device to ensure you don't cause any issues!
[Google Pixel 2 XL ROMs, Kernels, Recoveries, & Oth] dijeypee:
Oh shoot* okay i will remove it asap. Thank tou again
[Google Pixel 2 XL ROMs, Kernels, Recoveries, & Oth] WillowTree:
First and foremost, thanks for the hard work!

I can't seems to get it working, I'm not getting log after following the instructions and rebooting. I've attached screenshots.

Thanks in advance
[Google Pixel 2 XL ROMs, Kernels, Recoveries, & Oth] pkgnex:
That's odd! It appears you have a busybox installation, the script is in the right location and permissions are set right, and magisk is running the script as a late-start service. It looks like you're just not getting the output log.

Are you waiting for 30 seconds after boot before checking for the output file?

If so, other than that:

I noticed your file explorer says "sdcard". Can you ensure that it is the /storage/emulated/0 directory you're looking in?

What kernel are you using?

Can you tell me what the IO scheduler is listed when you open the EX Kernel Manage app? (If it is "noop" the script is almost certainly running, at least).

You might try removing the init.d injector module as well. It's not needed for my script, and while I doubt it's causing any conflict, it's something to try.
[Google Pixel 2 XL ROMs, Kernels, Recoveries, & Oth] WillowTree:
Just because you answered my post the output log decided to show up after my recent reboot. I rebooted atleast 4-5 times with different approaches and yet no log but yet it magically appears :eek:

I did check /storage/emulated/0 aswell before.

I am using the ElementalX kernel and always wait atleast 30 sec before checking for the output-log.

The wierd thing still is that i am getting Readahead of 1024. Could that be because of some script update that I'm not aware of?

Thanks for the hard work yet again! :highfive:
[Google Pixel 2 XL ROMs, Kernels, Recoveries, & Oth] pkgnex:
Readahead of 1024 is correct - my script does not change it. After extensive testing, I found that 1024 (which is the stock value) results in the best i/o throughput when averaged over varying file sizes that users are likely to encounter.

I'm glad the output file is working for you now. I will probably add a little more sleep time back in the next version, as that may help the script keep from getting interrupted.
[Google Pixel 2 XL ROMs, Kernels, Recoveries, & Oth] WillowTree:
Got you :good:

If i were to use your script with xFirefly93's script, will i get two output logs that'll tell me that both are running correctly?
[Google Pixel 2 XL ROMs, Kernels, Recoveries, & Oth] pkgnex:
Yes, you should.
[Google Pixel 2 XL ROMs, Kernels, Recoveries, & Oth] WillowTree:
Thanks for the help.

Sidenote; should i enable the adaptive battery function?

Will it truly help saving battery?
[Google Pixel 2 XL ROMs, Kernels, Recoveries, & Oth] pkgnex:
I enabled it. I certainly don't think it hurts anything...
[Google Pixel 2 XL ROMs, Kernels, Recoveries, & Oth] JeromeLeung:
Should this work with the Pixel 3 XL as well?
[Google Pixel 2 XL ROMs, Kernels, Recoveries, & Oth] pkgnex:
I wouldn't use it on the Pixel 3 series because I don't know if the GPU/CPU items are compatible.

However, based on another user's request, I did up load a "generic" version in the OP that should be safe to use on any device running 8.0 or newer, so you can give that one a shot if you want.
[Google Pixel 2 XL ROMs, Kernels, Recoveries, & Oth] pkgnex:
New Version!

Updated!

94pks20 is released with primarily battery life improvements I found via testing, but also to extend boot delay slightly to better ensure script executes at late-start-service runtime even for users with numerous magisk modules in use, and to change the script to a .sh file extension to provide for more robust handling and future flexibility (see OP for instructions - delete .txt from file name before copying and changing permissions, but leave the .sh extension).

File in OP, descriptive change log in 2nd post.

Enjoy!
[Google Pixel 2 XL ROMs, Kernels, Recoveries, & Oth] dijeypee:
Hi can you upload the generic pks again? I formatted my phone and i forgot to back up the pks :( thank youuuu
[Google Pixel 2 XL ROMs, Kernels, Recoveries, & Oth] pkgnex:
Done!
[Google Pixel 2 XL ROMs, Kernels, Recoveries, & Oth] dijeypee:
Wow that was quick! YOU THE BEST
[Google Pixel 2 XL ROMs, Kernels, Recoveries, & Oth] pkgnex:
No problem. Glad to help!
[Google Pixel 2 XL ROMs, Kernels, Recoveries, & Oth] dijeypee:
Hi im back hehe. I just need help with something. Well, before i even installed your script my phone heats up from 34-38°c when scrolling through fb, twitter, reddit, etc. And its still the same when i installed your script. Im just wondering if you could help me with changing values of my interactive governor? The first one on the left is the little cluster and big cluster on the right
[Google Pixel 2 XL ROMs, Kernels, Recoveries, & Oth] xFirefly93:
Interactive and EAS isn't working specially well together at all.. That's why your phone is turning into a frying pan.
[Google Pixel 2 XL ROMs, Kernels, Recoveries, & Oth] dijeypee:
Sorry, may i ask whats eas? :( Is it this script?
[Google Pixel 2 XL ROMs, Kernels, Recoveries, & Oth] xFirefly93:
EAS = Energy Aware Scheduling.

EAS Explanation

Which kernel are you on?
[Google Pixel 2 XL ROMs, Kernels, Recoveries, & Oth] dijeypee:
This is what i found

Kernel Version:

Linux localhost 4.4.23+ #1

Wed Jul 4 23:11:05 CST 2018

aarch64
[Google Pixel 2 XL ROMs, Kernels, Recoveries, & Oth] xFirefly93:
Stock kernel..?
[Google Pixel 2 XL ROMs, Kernels, Recoveries, & Oth] dijeypee:
Yes, im using a custom rom -- resurrection remix android 8.1

And is using a kirin.

No support group for kirin processors thats why im having a hard time finding tweaks for my phone. ?
[Google Pixel 2 XL ROMs, Kernels, Recoveries, & Oth] pkgnex:
Yeah, you bought a device that isn't very widely supported here on XDA.

You're going to have to do any tweaking mostly on your own by trial and error!
[Google Pixel 2 XL ROMs, Kernels, Recoveries, & Oth] xFirefly93:
Not for sounding like a ***** or so but..

Sell it, and get at least a Pixel 2 / Pixel 2 XL and join the dark side of the force. We have cookies, and kernels, ready for you over here!
[Google Pixel 2 XL ROMs, Kernels, Recoveries, & Oth] dijeypee:
I was actually planning on buying one! Is there still issues with the screen? I heard there were issues before?
[Google Pixel 2 XL ROMs, Kernels, Recoveries, & Oth] xFirefly93:
My screen have been perfect since Day 1. Though, I bought my Pixel 2 back in January-February this year so I've no experience of the very first batches regarding the screen quality.
[Google Pixel 2 XL ROMs, Kernels, Recoveries, & Oth] Juzman:
I got mine on release day. Only issue with screen on my 2 XL is if I hold it at a weird angle and make sure the background is white. There's a slight blue shift.

Not enough for me to say there is an issue.
[Google Pixel 2 XL ROMs, Kernels, Recoveries, & Oth] pkgnex:
New Version!

Updated!

Version 21 in OP.

Change log in 2nd post.

Enjoy!
[Google Pixel 2 XL ROMs, Kernels, Recoveries, & Oth] xFirefly93:
Just wanted to ask in which sysfs folder / path did you find the 'txqueuelen' tunable?
[Google Pixel 2 XL ROMs, Kernels, Recoveries, & Oth] pkgnex:
Every sub-directory in /sys/class/net
[Google Pixel 2 XL ROMs, Kernels, Recoveries, & Oth] def-g:
What's the difference between regular and generic version? And does this work on all custom kernels?
[Google Pixel 2 XL ROMs, Kernels, Recoveries, & Oth] pkgnex:
Either works on any kernel (custom or stock) on Pixel 2 / XL, but the normal version has a few extra Pixel 2 XL specific things, whereas the generic version can be safely used on any device since pretty much the inception of Android.