yashsingh1/xdaforums huggingface dataset:
[Google Pixel 2 XL ROMs, Kernels, Recoveries, & Oth] def-g:
Gonna give it a go. Been using unified script on Flash with great results. I'll test and give my thoughts.
[Google Pixel 2 XL ROMs, Kernels, Recoveries, & Oth] pkgnex:
:highfive:
[Google Pixel 2 XL ROMs, Kernels, Recoveries, & Oth] def-g:
I've been a fan of Sultan's Kernel. Because of the speed and fluidity. However battery life wasn't as good as on Flash. This Script not only improves battery life. But noticably improves performance. We'll Done?
[Google Pixel 2 XL ROMs, Kernels, Recoveries, & Oth] pkgnex:
Thanks for the kind words - I'm glad you are finding the script beneficial!
[Google Pixel 2 XL ROMs, Kernels, Recoveries, & Oth] pkgnex:
New Version!

Updated!

Version 22 (94pks22.sh) now available in the OP.

For some reason, Google changed read_ahead_kb back to pre-Oreo levels (128) with the November update. This actually hurts i/o performance on normal workloads (I double-verified this with extensive benchmarking). The script therefore now forces the more recent 1024 value on all scheduler blocks (again, I reverified this is the optimal setting on Pixel 2/XL), to bring performance back up to pre-November levels.

Enjoy!
[Google Pixel 2 XL ROMs, Kernels, Recoveries, & Oth] xFirefly93:
I am wondering why Google lowered / decreased the readahead kb value from 1024kb to 128kb.

The only benefit from a lower readahead value is less thrashing when using a lot of apps, as reported by Nathan over at Telegram through Googles own in-house channel(s), see attached screenshot / picture and link below.

Thrashing
[Google Pixel 2 XL ROMs, Kernels, Recoveries, & Oth] pkgnex:
Maybe that's why they changed it.

I've never noticed such "thrashing", nor any other detrimental effects of having read ahead higher - at least up to 1024 on the pixel 2 or 512 on older devices.

The reduction in read/write speeds when changing from 1024 to 128 is real, though (albeit small and mostly not noticeable on modern devices).
[Google Pixel 2 XL ROMs, Kernels, Recoveries, & Oth] xFirefly93:
By how much is the overall read/write speed(s) reduced with readahead set to 128kb, compared to 1024kb?
[Google Pixel 2 XL ROMs, Kernels, Recoveries, & Oth] pkgnex:
It depends on the file size being read / written, but my results show anywhere from 1% to 4%.
[Google Pixel 2 XL ROMs, Kernels, Recoveries, & Oth] Gordietm:
I'm trying your script with the Kiriskura kernel. However your script disables zram, wouldn't that detract from his zram improvements with compressed logarithms?

So I modified your script to keep zram enabled. Let me know if what I'm doing is ok? Or maybe you need a script specifically tailored to that kernel?
[Google Pixel 2 XL ROMs, Kernels, Recoveries, & Oth] Freak07:
Yeah if that gets disabled my whole ZSTD backport from kernel/common is negated.

Usually I’m also on the side of disabling ZRAM. But with this device and the RAM situation it’s better to enable it in my opinion.

It’s described in bigger detail here.

https://xdaforums.com/pixel-2-xl/development/17-11-2017-kiriskura-kernel-1-0-0-t3706286/post77995970
[Google Pixel 2 XL ROMs, Kernels, Recoveries, & Oth] Gordietm:
I just had a reboot. Im going to run this kernel just by itself for now

Here is the ramoops file:

https://drive.google.com/file/d/14hKzZ5_grnA8Wh8LXc-WicyJFKmKSE1v/view?usp=drivesdk
[Google Pixel 2 XL ROMs, Kernels, Recoveries, & Oth] pkgnex:
I don't think zram is needed with this device at all. That said, if Freak07 has cooked up something with his zram backport that makes it truly beneficial, then yes, you can disable the zram disabling in my script (just comment the lines out or delete them entirely). It shouldn't matter for stability either way.

I haven't tried Freak07's zram backport implementation, but I have found nothing on my device that indicates zram is useful... yet.

Please let everyone know if you do/don't have any reboots without the scripts.

As I mentioned in xFirefly93's thread, this is pointing to be at least partially kernel related since nobody running any other kernel is having reboots with either of our scripts. There is nothing in my script that should be causing reboots - the tweaks included have been stable for all users, through many different versions of Android, on multiple devices, and with numerous kernels.

The only possibility would be if Freak07 is doing something different than anyone else - and that difference is somehow incompatible with some tweak both xFirefly93 and I are using. However, I think it is more likely that some kernel backport or change Freak07 has implemented just isn't playing nice with all Pixel 2 / XL devices.
[Google Pixel 2 XL ROMs, Kernels, Recoveries, & Oth] Gordietm:
OK, thanks.

I'll run this kernel without any scripts for awhile and see if I have another freeze and reboot.
[Google Pixel 2 XL ROMs, Kernels, Recoveries, & Oth] Freak07:
The log you linked is a kernel panic this time.

Try the kernel without the script and report back if you face it again.

I have maybe a few ideas what could be happening for you it it isn’t the script. We just need to isolate the issue so it can be properly debugged.

All the reboots you linked happen relatively fast in relation to your last reboot.

I’m now on nearly 4 days uptime without a single hiccup/crash/panic.

What did you do when this reboot happened?

Browsing chrome?

---------- Post added at 02:51 PM ---------- Previous post was at 02:33 PM ----------

Yeah my kernel is quite a bit different to the other kernels actually.

I never faced a reboot on the release kernels up to now. As said on the last post here my uptime is nearly 4 days without a reboot.

the issue needs to be isolated, so we’re sure why it’s happening. It seems to be at least have increased probability of facing it with the scripts, looking at the logs and the timespan of it happening. I’m not sure.

I don’t want to blame your script or make anyones work bad. I just hope we can resolve it completely. :svetius:
[Google Pixel 2 XL ROMs, Kernels, Recoveries, & Oth] Gordietm:
I selected an app to open and the phone froze. Can't remember which app, I think chrome canary but not sure.

I've since deleted the script and I won't use any until the issue is resolved.

Thanks for your help.
[Google Pixel 2 XL ROMs, Kernels, Recoveries, & Oth] pkgnex:
Agreed. It seems like everyone who reported it on your thread was using either my or xFirefly93's script. On the other hand, the only people using our scripts that have reported it in our threads also happen to be using your kernel. :confused:

Have you looked through the scripts to see if anything stands out to you as being potentially incompatible?
[Google Pixel 2 XL ROMs, Kernels, Recoveries, & Oth] xFirefly93:
+1

If something in my script is breaking / causing stability issues on Kiriskura kernel, I will remove it ASAP.

I am not into what I am doing with the goal of screwing people's life up, so.
[Google Pixel 2 XL ROMs, Kernels, Recoveries, & Oth] Lagarde:
[MENTION=8852292]xFirefly93[/MENTION] [MENTION=4793042]pkgnex[/MENTION]

Kiriskura kernel, tested with both scripts. No reboots or lockups in the last 48hrs. I still have gremlin issues with battery drain, but no lockup/reboot. :)
[Google Pixel 2 XL ROMs, Kernels, Recoveries, & Oth] sruel3216:
Sold my pixel 2 xl and got a OnePlus 6t. Any plans to bring this to the 6t? Loved it on pixel
[Google Pixel 2 XL ROMs, Kernels, Recoveries, & Oth] pkgnex:
Sorry for the late response... you can download the "generic" version from the OP and use it on the OnePlus 6t.

Should work great!

Let me know one way or the other.
[Google Pixel 2 XL ROMs, Kernels, Recoveries, & Oth] pkgnex:
New Version!

Updated!

Version 23 (94pks23.sh) now available in the OP.

No real changes - just updated the script to reference the new and correct file placement for Magisk 18.0+ (see also the OP). For now the old location is symlinked, but I imagine that will go away soon. Best to prepare now!

Please start placing the script in the new late-start boot service location from now on!

( /data/adb/service.d/ )

Also, several people have asked if they can use my script on other devices. The answer is now YES!

To use my script on another device, simply use the "generic" one in the OP as it is device agnostic. This script should work on virtually any device with any Android version!

Enjoy!
[Google Pixel 2 XL ROMs, Kernels, Recoveries, & Oth] sruel3216:
It's working on my 6t. This phone already flies though so hard to tell a difference. But I'll continue to use since I loved your work on pixel!
[Google Pixel 2 XL ROMs, Kernels, Recoveries, & Oth] pkgnex:
:good:
[Google Pixel 2 XL ROMs, Kernels, Recoveries, & Oth] sruel3216:
OnePlus 6t here and my battery seems even better using the script. Just look at these numbers! All on a single charge.
[Google Pixel 2 XL ROMs, Kernels, Recoveries, & Oth] pkgnex:
Awesome! Glad the generic version is working well on other devices!
[Google Pixel 2 XL ROMs, Kernels, Recoveries, & Oth] kirschdog1:
Which file explorer did you use?
[Google Pixel 2 XL ROMs, Kernels, Recoveries, & Oth] sruel3216:
I use root explorer

---------- Post added at 06:08 PM ---------- Previous post was at 06:07 PM ----------

Hey PK some members with 6t have been trying your script. Any chance you can make one for the 6t specifically if there is high enough demand?
[Google Pixel 2 XL ROMs, Kernels, Recoveries, & Oth] pkgnex:
I'm always willing to help the community out if I can, but I don't have a 6t, so I'd be flying blind.... a few questions:

Is there something specific you want in the script that isn't already in the generic version?

If so, can you also post screen shots of basically all the different pages in the EX app running on your device to give me sense of what I'd be working on?
[Google Pixel 2 XL ROMs, Kernels, Recoveries, & Oth] WillowTree:
I've got oneplus 6 (that I just bought) and screenshotted every page in ex kernel manager.

https://imgur.com/a/LZwk6jL

If you still want to make it oneplus specific. No worries if not :)
[Google Pixel 2 XL ROMs, Kernels, Recoveries, & Oth] pkgnex:
The good news is that I don't think I tuned anything in my Pixel-2 script that isn't available or that would conflict with the OP-6.

Have you tried my 94pks23 script on the device yet? If not, could you do so and then report back? I think the risk of anything bad happening is minimal...
[Google Pixel 2 XL ROMs, Kernels, Recoveries, & Oth] WillowTree:
I will do so, and come back with some feedback :o
[Google Pixel 2 XL ROMs, Kernels, Recoveries, & Oth] jhpdroid:
I've been running this script in my op6t for a while now, can't say for sure if it helps but I'm getting fantastic battery life (60% left, almost 7 hours sot). All i did was change busybox to toybox and place it in /data/adb/service.d
[Google Pixel 2 XL ROMs, Kernels, Recoveries, & Oth] pkgnex:
That's awesome! Glad the script is working for you.

I would think that if you install osm0sis' busybox Magisk module, you wouldn't even have to change from busybox to toybox... not that it really matters.
[Google Pixel 2 XL ROMs, Kernels, Recoveries, & Oth] xFirefly93:
Have you stopped working on PK's Tuning Script?
[Google Pixel 2 XL ROMs, Kernels, Recoveries, & Oth] pkgnex:
No, but I think it's in a good and stable place, especially for Pixel 2.

If I come across any other tweaks that I verify help performance or battery life without hurting the other, I will definitely add them in!

BTW, congrats on the success of your scripts - you've put a ton of effort into them and I know you deserve it!
[Google Pixel 2 XL ROMs, Kernels, Recoveries, & Oth] xFirefly93:
Gotcha! And thank you, it was after all your influences and own idea / concept that made me walk into this pretty simple, but amazing, territory.

:highfive:
[Google Pixel 2 XL ROMs, Kernels, Recoveries, & Oth] methuntt:
Thanks for the script man?.. Screen on - 4hrs 10 min

Best performance and battery i had in my pixel 2.View attachment 4723365
[Google Pixel 2 XL ROMs, Kernels, Recoveries, & Oth] pkgnex:
NP. Glad to hear it!
[Google Pixel 2 XL ROMs, Kernels, Recoveries, & Oth] pkgnex:
New Version

Updated!

Version 24 (94pks24.sh) now available in the OP.

- Based on discussions in the blackenedmod forums, I decided to revisit the old ext4 filesystem tweaks... and found both more performance (verified by i/o benchmark) and battery life (theoretical) improvements over anything else out there!

- I also reduced the size of the kernel entropy pool a bit as many users on these forums seem to like it better.

Enjoy!
[Google Pixel 2 XL ROMs, Kernels, Recoveries, & Oth] WillowTree:
No generic version? Or can we use that on other phones aswell?
[Google Pixel 2 XL ROMs, Kernels, Recoveries, & Oth] pkgnex:
Not yet. Want to let it run a day or two to make sure it's stable on pixel 2 first before pushing the generic for every other device.

Won't be long, though.
[Google Pixel 2 XL ROMs, Kernels, Recoveries, & Oth] WillowTree:
Oki, thanks for the clarification ?
[Google Pixel 2 XL ROMs, Kernels, Recoveries, & Oth] methuntt:
Hey dev, sometimes script interferes with viper4android ( not working if i use script)

Anyway to use without interfering viper4android ?
[Google Pixel 2 XL ROMs, Kernels, Recoveries, & Oth] lonton:
I'm running the script together with Viper fine.
[Google Pixel 2 XL ROMs, Kernels, Recoveries, & Oth] pkgnex:
I don't know why that would be the case - I've used this with viper for years, except for the most recent mount options. Is it just the new version, or did previous versions also cause you problems?

Thanks for letting me know it's not affecting everybody at least. I'm betting it not the script, but I can't rule it out yet.
[Google Pixel 2 XL ROMs, Kernels, Recoveries, & Oth] Badger50:
Fine here as well with V4A+ Dolby :good:
[Google Pixel 2 XL ROMs, Kernels, Recoveries, & Oth] sublimaze:
94pks24 kills data signal on Bootleggers + Kirisakura.

I had to revert to my previous custom script based on 94pks23.
[Google Pixel 2 XL ROMs, Kernels, Recoveries, & Oth] pkgnex:
This may sound odd, but that's great feedback for [MENTION=8852292]xFirefly93[/MENTION] and myself!

Now I can cross-check what he changed from 9.4-9.5 and what I changed from 23 to 24 to see what was the same, and eliminate it!
[Google Pixel 2 XL ROMs, Kernels, Recoveries, & Oth] pkgnex:
Please try v25 now in the OP. We'll get through this and help everyone on this script and blackenedmod out!
[Google Pixel 2 XL ROMs, Kernels, Recoveries, & Oth] sublimaze:
94pks25 kills data signal too.

Here are the steps I use to test:

1. Disable WiFi and mobile data

2. Delete all script-related logs

3. Move the new untested script to /data/abd/service.d

4. Change script permissions to 0755

5. Reboot

6. Wait until "script successful" log is finished

7. Enable mobile data
[Google Pixel 2 XL ROMs, Kernels, Recoveries, & Oth] pkgnex:
Thanks! I'll see if I can reproduce it myself...

EDIT:

I can't reproduce it on stock ROM with EX kernel, and I really don't want to flash a new ROM to figure this out.

Do you mind being my tester for a bit - when you have time? I don't think I'll have to take too many more shots at it...
[Google Pixel 2 XL ROMs, Kernels, Recoveries, & Oth] pkgnex:
Can you please give 25b now in the OP a go, and report back when you get a chance?
[Google Pixel 2 XL ROMs, Kernels, Recoveries, & Oth] sublimaze:
I'd be happy to test :good:
[Google Pixel 2 XL ROMs, Kernels, Recoveries, & Oth] pkgnex:
You're the man! Thanks in advance - and don't worry if you can't get to testing for a while or need a break - the same may happen with me.

I have high hopes for 25b...
[Google Pixel 2 XL ROMs, Kernels, Recoveries, & Oth] sublimaze:
*You* are the man! 94pks25b works :D

Thanks for sharing your work and maintaining this thread.
[Google Pixel 2 XL ROMs, Kernels, Recoveries, & Oth] pkgnex:
Awesome! Thanks for verifying it works!

If it's not too much to ask... can you try version 25c now in the OP?

This one is just seeing if I can put back all the "goodies" that I stripped out before I found the one thing that was screwing up some people's data connectivity...

If this one works, I'll leave you alone :D
[Google Pixel 2 XL ROMs, Kernels, Recoveries, & Oth] sublimaze:
94pks25c works too :good:

I haven't had time to examine the differences. What was causing the data drops?
[Google Pixel 2 XL ROMs, Kernels, Recoveries, & Oth] pkgnex:
Thanks again!

I'll release 26 soon - and you'll get some props for helping out!

(the problem was using the "nosuid" option when remounting /system.)
[Google Pixel 2 XL ROMs, Kernels, Recoveries, & Oth] xFirefly93:
Should I remove nosuid from all remounted partitions, or just keep it as it is?
[Google Pixel 2 XL ROMs, Kernels, Recoveries, & Oth] pkgnex:
New Version

Updated!

Version 26 (94pks26.sh) now available in the OP.

- Thanks to test support from [MENTION=3049201]sublimaze[/MENTION], I believe we figured out the "data connectivity loss" issue on the previous version, and which has been plaguing custom ROM users on BlackenedMod since v9.4.

This is a significant "win" that I couldn't have accomplished without sublimaze's testing support, as I could not replicate the issue on stock ROM and really didn't have the time to go custom ROM right now.

Needless to say, this derp has been corrected in version 26. If you installed v24 or one of the v25 test builds, please update! Versions v23 and prior did not have this error.

I'll be letting [MENTION=8852292]xFirefly93[/MENTION] know how to fix the issue as well.

Enjoy!

P.S. I feel comfortable releasing a generic version now as well - it's in the OP.
[Google Pixel 2 XL ROMs, Kernels, Recoveries, & Oth] pkgnex:
Remove nosuid from the /system remount line only.

You can copy from my script (v26) if you want, or just make that one change manually to yours - should work either way, but I also cleaned up the noatime / nodiratime / relatime mess in mine already.

Please credit sublimaze for his help in finding this - I couldn't have done it without his willingness to test rapid changes to the script!
[Google Pixel 2 XL ROMs, Kernels, Recoveries, & Oth] xFirefly93:
What's your thoughts on using the 'no_block_validity' mounting option? As far as I get it by reading a little about it, disabling / set it to "no" may reduce potential amount of CPU and memory overhead.
[Google Pixel 2 XL ROMs, Kernels, Recoveries, & Oth] pkgnex:
It made no difference in my testing. With all the other items set to minimize journaling, I can't believe it would matter much, but I see no reason why NOT to include it, either. :)
[Google Pixel 2 XL ROMs, Kernels, Recoveries, & Oth] pkgnex:
Hey, I figured this out!

The kernel ext4 manual pages state that block_validity is only a debugging mode, it does hurt performance, but is off by default on all kernel versions, so setting no_block_validity is unnecessary and redundant to the kernel default.

That explains why it made no difference in my testing, I suppose!
[Google Pixel 2 XL ROMs, Kernels, Recoveries, & Oth] pkgnex:
Update: Version 2

Updated!

See new file (94pks2) in OP, change log in second post.

(Now I know why everyone reserves a post or two after their OP's) ;)
[Google Pixel 2 XL ROMs, Kernels, Recoveries, & Oth] CyberpodS2:
Running latest on this with no ill effects. Looking forward to a happy marriage. Lol
[Google Pixel 2 XL ROMs, Kernels, Recoveries, & Oth] pkgnex:
Same setup I'm running!
[Google Pixel 2 XL ROMs, Kernels, Recoveries, & Oth] imaverik:
6hours in.. love it so far!
[Google Pixel 2 XL ROMs, Kernels, Recoveries, & Oth] veetoe:
I cannot get this to do anything. Not sure what I'm doing wrong. I've placed it in the magisk service.d folder with the correct permissions, and even see it in the magisk log that it's executing the script, yet nothing changes. I've also tried it in post-fs-data.d and it also doesn't work but some weird things happen, like some of the magisk modules won't load. I also tried packaging and running it as a module and same thing, shows that it's executing but nothing changes. I even tried running it as a .sh file with root explorer and nothing. Ex manager has nothing set on boot other than some color settings.

Any ideas?

Thanks
[Google Pixel 2 XL ROMs, Kernels, Recoveries, & Oth] pkgnex:
Glad to hear it.

It very likely is working! What this script does is tune some file system, memory, I/O, and kernel parameters soon after start-up. There is no toast message or anything like that... it just echo's some select values that have shown slight improvements in performance and/or battery life. You might notice it, or you might not, depending on how yo use your device.

Modules not loading when you put it in post-fs-data is expected due to the timing of the script - it will delay Magisk too long and prevent modules from loading if you put it there (so back to service.d it goes ;))

Try opening a kernel app (like EX or Adiutor) a few minutes after boot and see if the io scheduler is noop, read ahead is 512, that zram is off, that LMK is really high for empty / hidden apps, or that any of the other parameters in the script have stuck. If so, it's working. If not, report back and I'll try to help.
[Google Pixel 2 XL ROMs, Kernels, Recoveries, & Oth] veetoe:
Yes this is what I have tried. I will reboot and wait well over the 100 seconds that the script is set for and then check and refresh ex manager and the values are still stock. Same thing when I navigate to them manually with root explorer to view their values, they are stock. I've tried lowering the sleep time in the script as well and no change. Lol this should be so simple I don't get why it won't work. I had a module that would load a script in late start service and it worked as it should. Frustrating. Could the modules be interfering? I think with your first version of it a while back I had tried with no modules and same results, but I'm not sure. Its weird that in the magisk manager log it shows the script being executed.
[Google Pixel 2 XL ROMs, Kernels, Recoveries, & Oth] pkgnex:
That is weird! It sounds like you're doing everything right, so I don't understand why it wouldn't be working - it's worked for me on stock and Flash kernels since day-1.

Outside shot here... do you have busybox installed? I use the "Busybox for Android NDK" Magisk module by oms0sis. If you don't have busybox installed, I suppose your device might not recognize any of the commands. Also, make sure to delete the ".txt" file extension before you put it in service.d.

Not trying to insult your intelligence... really just grasping at straws.
[Google Pixel 2 XL ROMs, Kernels, Recoveries, & Oth] veetoe:
Yeah I use the same busybox module and verified it's working in terminal. I removed the .txt extension as well and set the permissions. I tried removing the sleep timer and adding .sh extension and executing it with root explorer and it doesn't apply any changes. I don't get it. I'm using kirisakura kernel.
[Google Pixel 2 XL ROMs, Kernels, Recoveries, & Oth] pkgnex:
I don't get it either! I've not used that kernel, but this script has worked on every kernel I've ever used - and across several different devices.

I'll try some things to see if I can figure anything out. If you get it working, please let me know what you did!

.

.

.

So, I re-downloaded from the op, followed my instructions, rebooted, and everything still works.

Can you confirm both the path you're putting the file in and the permissions are as shown in the attachment to this post?

We may have to ask your kernel dev if he has any ideas...

If you're feeling adventurous and want to try another kernel just to see if it matters, that might help troubleshoot. I may try your kernel later when I have more time as well.
[Google Pixel 2 XL ROMs, Kernels, Recoveries, & Oth] veetoe:
I'll have to mess with it again a while later today, but yeah that's where I had it with those permissions. I had tried the first version of the script a few weeks ago, I think I may have been on electron kernel then, and still couldn't get it to work. It's weird that a module that uses the service.sh script works but this doesn't, and even the fact that magisk log is showing 94pks executing. Really strange. You would think something is overriding it but the only thing that could be is ex kernel manager and I had all set on boot settings disabled for it, except color settings.