[Google Pixel 2 XL ROMs, Kernels, Recoveries, & Oth] pkgnex:
Change Log:

Version 34 (98pks34.sh):

Version added with no disabling of zram.

V33 is still active for those who don't need / want zram.

V33 generic is still active as well (V34 generic would be the same as generic version does not alter zram).

Version 33 (98pks33.sh):

- Updated with Franco Dev-Team tuned Deadline scheduler (still the fastest). Script uses this if Deadline is available in your scheduler, else it defaults to using Noop.

- Other very minor tweaks based on testing, and some code cleanup

Version 32 (98pks32.sh):

- Updated for Magisk 19.4 (primarily eliminated mounting calls on / and /system to prevent root interference or verity problems due to SAR implementation now standard)

- Backed off the schedutil governor performance tweaks just a bit, still more performance oriented then v30 and prior, just not as extreme

- Removed wakelock blocking (for now) for evaluation. Most kernels already block safe wakelocks anyway. If I find none of the benefits I'm looking for, I may add them back in the next release.

- Released corresponding device-generic version due to important Magisk / SAR compatibility updates

Version 31 (98pks31.sh):

- Simplified some VM settings / reverted to stock where no difference was noted

- Simplified some block IO parameters / reverted to stock where no difference was noted

- Increased transmission queue buffer based on latest testing (still lower than stock)

- Tuned Schedutil governor settings to bias for more performance, reduce lag

- Increase GPU min frequency to 342 MHz step (2nd from bottom) based on testing to reduce lag

- Note that these changes did not appreciably affect battery life in testing

- Simplified output file write-out

- Released official "generic device" companion script of this version for those asking

Version 30 (98pks30.sh):

! GOOD TO GO FOR Q-FINAL / A-10 !

- Re-enabled stock zram - was causing freezes after about 24-36 hours of uptime

- Re-enabled vm tweaks for increased battery life (disabled pdflush periodic writebacks, lowered potential for large data writes causing hang-ups as a result in dirty ratios, adjusted cache pressure to not favor dentry/inodes quite so hugely over pagecache)

- Blocked a few more known and safe-to-block wakelocks

Version 29 (98pks29.sh):

Reverted some changes that were causing some serious jank / freezes:

- Went back to noop

- Reintroduced periodic pdflush writeback (although less frequent than stock)

Version 28 (94pks28.sh):

Biggest changes in a while!

- Increased run delay to 2 minutes to stay out of kernel apps' way

- Reverted tcp_ecn to 2 (stock) for slight decrease in network latency

- Substantial vm tweaks for increased battery life (disabled pdflush periodic writebacks, lowered potential for large data writes causing hang-ups as a result in dirty ratios, adjusted cache pressure to not favor dentry/inodes quite so hugely over pagecache)

- Right-sized nr_requests for any scheduler (not just noop) relative to built-in Android queue-depth

- Changed scheduler to deadline* with Franco Dev Team's tuning tweaks (still fastest i/o I can manage in testing)

* Device-generic version (94pks28generic.sh) was left unchanged with noop scheduler

Version 27 (94pks27.sh):

- Fixed for Android Q while keeping backward compatibility with prior Android versions.

- Increased run delay to 90 seconds to stay out of magisk module or kernel apps' way.

Version 26 (94pks26.sh):

- Updated one minor (but hard to find), error in mount option filesystem tweaks that had been causing data connectivity issues on custom ROM's using this script or BlackenedMod.

- SPECIAL THANKS to [MENTION=3049201]sublimaze[/MENTION] for testing iterations until we found the root cause of this issue!

Version 25 - skipped, test versions for [MENTION=3049201]sublimaze[/MENTION] to help me figure out data connection issues.

Version 24 (94pks24.sh):

- Updated ext4 filesystem tweaks for even better battery life and performance

- Small reduction of entropy pool size based on other user feedback

Version 23 (94pks23.sh):

- Change header to list new Magisk 18.0+ late-start boot service folder location

- SEE ALSO OP FOR THIS LOCATION

Version 22 (94pks22.sh):

- Force read_ahead_kb to 1024 for faster I/O performance on all realistic file sizes

Version 21 (94pks21.sh):

- Increased load delay at boot back to 60s.

Version 20 (94pks20.sh):

- Added .sh extension to file to allow more flexibility for future tuning (now just delete .txt, but leave .sh in the file name before copying to run location)

- Slightly increased load time at boot to 40s to ensure script runs even for users with many magisk modules

- Reduced foreground app schedtune boost to 5% (was 10%) for battery saving when multiple apps are open with no perceived detriment to performance or app switching

- Increase dirty_expire and dirty_writeback timings for less overhead, reduced battery, and improved performance with no ill effects noted

- Reverted GPU min clock increase due to my testing finding the speed benefit was not noticeable but battery life was negatively affected

Version 19 (94pks19):

- Reduced load time at boot (enabled by re-ordering of script) to 30s

- tcp_ecn set to 1 for across-the-board network speed enhancement when handshake allows

- reduced txqueuelen to 128 for network speed enhancement on 4g/wifi (less bufferbloat)

- added wakelock blocker courtesy of [MENTION=8852292]xFirefly93[/MENTION], but only for blocking wakelocks I have actually seen in BBS for Pixel 2 / XL.

Version 18 (94pks18):

- Increase cpu governor up-rate-time; VERY significant battery help with no performance degradation noticed.

- Reduce vm dirty ratio and dirty expires slightly to reduce potential (although unlikely) excess caching and latency from memory write-out.

- Slight code re-ordering for potential quicker boot delay in the future

Version 17 (94pks17):

- Schedtune code cleanup

- GPU min frequency set to 342 (performance boost with no adverse battery drain per [MENTION=8852292]xFirefly93[/MENTION] testing)

- Increase cpu governor down rate limit by 25% for better performance with minimal battery life impact.

Version 16 (94pks16):

- 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!

Version 15 (94pks15):

- Fs dir-notify disable.

- Schedtune parameter tweaks for performance increase.

Credit: Both of the above were initiated by [MENTION=8852292]xFirefly93[/MENTION], I only slightly modified the Schedtune parameters.

Version 14 (94pks14):

- Revert disabling service_locator, otg_wakelock, and debug kernel modules - no real battery save noted in testing; and I had some issues with apps hanging that required location services that were resolved by getting rid of this code.

- Change rq_affinity from 2 to 1 - I verified with I/O benchmark testing that this provides a slight increase in I/O performance, especially reads and sqlite operations. No battery life impact noted during days of testing.

Version 13 (94pks13): Internal test build - not released (probably would have been unlucky anyway ;))

Version 12 (94pks12):

- Turn off iostats - by popular request (slight battery save)

- Increase vm stat_interval to 60 - Thx to xFirefly93 (slight battery save)

- Disable service_locator, otg_wakelock, and debug kernel modules - Thx to xFirefly93 (slight battery save)

Version 11 (94pks11):

- Delay script start by 30 seconds for users with multiple late-start scripts or other Magisk modules

- Increase timer for vm dirty writeback (saves battery from less wake-ups, cache integrity still reasonably protected by low dirty background ratio)

- Slight kernel entropy increase

Version 10 (94pks10):

- Increase min_free_kbytes - better performance based on testing

- Reduce entropy read_wakeup_threshold - to prevent blocking apps or commands if entropy drops

- Thrift ipv4 / network settings that were ineffectual - cleanup with better or same performance based on testing

- Reduce scheduler nr_requests - less overhead, subjective latency reduction

- Revert to default read_ahead_kb - better performance based on testing

Version 9 (94pks9):

- Slight change-up on kernel entropy settings to keep pool about half-full.

- tcp_max_syn_backlog and tcp_ecn parameters added (thanks [MENTION=4049833]Juzman[/MENTION] for getting me to look at these!) that seem to help network throughput slightly - they certainly don't hurt.

- Added fstrim for data, cache, and system partitions at end of script - because why not do this on every boot?

Version 8 (94pks8):

New file location noted in header: /sbin/.core/img/.core/service.d

-	Need to place script in this directory for Magisk 16.3 onward

-	Backward compatible for previous versions back to 14.5

Script now executes 70% faster after boot

-	Only sleeps for 30 seconds; verified to still run through Magisk late start service

Added file system optimizations for /system partition

Adjusted min_free_kbytes to 7 GB from 7.5

-	Should slightly raise available RAM for each node, no oom increase or other ill-effects verified through dmesg / kmesg logs

Reverted vm.vfs_cache_pressure to 20

-	Less subjective latency based on testing

Script success / fail write-out file now time stamped for users local time rather than UTC/GMT

Version 7 (94pks7):

- Removed LMK (yay!) based on multiple requests, advice from [MENTION=426561]Scott[/MENTION], and my verifying that nothing I tried improved over stock.

- Added back in some block-level scheduler queue tweaks that are not consistent (and not optimized) on all blocks in the stock configuration as I thought they were

- Cleaned up and re-organized the code - inspiration from [MENTION=4049833]Juzman[/MENTION]

- Re-evaluated vm settings [MENTION=426561]Scott[/MENTION]) and network tweaks [MENTION=4049833]Juzman[/MENTION]); I don't believe this resulted in any changes (except I'm trialing cache_pressure at 60 vice 20), but thanks for their advice, research, testing, and participation (which is also now credited in the script).

Version 6 (94pks6):

- Added feature: script now writes out a file "pks_script_result" to the /storage/emulated/0 (root of internal storage) directory when executed.

- If the file is present after attempting to run (or after a reboot if you have it in su.d, init.d, or service.d folders) then this indicates the script executed.

- If when you open the file in a text viewer it has a time/date stamp and the phrase "94pks6 successfully executed!", then it ran without errors.

- If when you open the file it says instead "94pks failed." then it threw some error code upon execution... but it was probably minor enough that the changes were applied (or the file wouldn't have been written ;)).

All the above is at least in theory. It seems to be working that way on my device. Thanks to [MENTION=426561]Scott[/MENTION] for the suggestion!

Version 5 (94pks5):

- Lowered last lmk slot (empty apps) much further - no appreciable loss of available RAM during my testing, less redraws in chrome tabs and reloading of recent apps.

Version 4 (94pks4):

- Fixed aggressive Lowmemorykiller / memory over-commit interaction issue (only last LMK slot now much more aggressive than stock, vm.overcommit_memory reverted to "1" (stock). The interaction with previous settings could cause an issue where no additional apps could be opened (they were immediately killed).

- Very minor tweaks to some vm caching parameters

Version 3 (94pks3):

Corrected swap off command to not throw error flag on execution

Altered tx_queue_len replacement command to skip non-linked file and not flag error on execution

Thanks [MENTION=4903174]Lessaj[/MENTION] and [MENTION=8317664]veetoe[/MENTION] for helping

Version 2 (94pks2):

1). Increased LMK levels

---- I tested for weeks, we have gobs of RAM, it should really only affect empty apps

2). Turned off swap and de-allocated zram space

---- With 4GB of RAM, do we need zram? I don't think so. I found benchmarks and day-to-day performance to be slightly better without it, plus this is further enabled by increased LMK levels (in theory).

3). Reduced the vm dirty expire / writeback by a factor of 10 (still far more aggressive than stock)

---- No real effect here, just walking back to stock since I see no real effect with these parameters on Pixel 2.

4). Enabled Schedutil governor IO_wait_boost flag for both little and big clusters.

---- Should boost performance / reduce latency during high I/O events, found it to marginally increase some benchmarks and subjective performance feel without affecting battery (YMMV).