Skip to content

Instantly share code, notes, and snippets.

@MrCarb0n
Last active July 19, 2022 01:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MrCarb0n/0c48f942f70c811523444401e72a0b39 to your computer and use it in GitHub Desktop.
Save MrCarb0n/0c48f942f70c811523444401e72a0b39 to your computer and use it in GitHub Desktop.
#!/system/bin/sh
# set -x
# detect total RAM
RAM="$(awk -F':' '/MemTotal/{gsub(/ /,"");print int($2/1024)}' /proc/meminfo)"
# aggressive LMK
MATH() { awk "BEGIN{print int($RAM*$1)}"; }
LMK1="$(MATH 5.1200)"
LMK2="$(MATH 7.6800)"
LMK3="$(MATH 15.360)"
LMK4="$(MATH 25.600)"
LMK5="$(MATH 35.840)"
LMK6="$(MATH 38.400)"
# settings prop
resetprop sys.lmk.minfree_levels "$LMK1:0,$LMK2:100,$LMK3:200,$LMK4:250,$LMK5:900,$LMK6:950"
resetprop lmkd.reinit 1
/system/bin/lmkd --reinit
# check prop
resetprop | awk '/sys.lmk.minfree_levels/'
# quit
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment