diff options
author | Cosme Domínguez Díaz <cosme.ddiaz@gmail.com> | 2018-05-06 16:36:28 +0200 |
---|---|---|
committer | Cosme Domínguez Díaz <cosme.ddiaz@gmail.com> | 2018-05-06 20:04:36 +0200 |
commit | 544876dbd9415ff28f6401f6197f6e45a1c0759f (patch) | |
tree | 94a89828782876f6074c58706b49a3aedffee9c2 /rootdir | |
parent | efe230113b57b89195b2e741cd317bb083486479 (diff) |
msm8996-common: Disable Transparent Huge Pages (THP) when we don't have enough RAM.
* My device has 6GB of RAM so I didn't notice any issue. However devices with 3GB or
less become unusable with THP enabled, according to @YaroST12
* Also, for devices with enough RAM, we'll restrict THP to madvise regions as
suggested by the kernel documentation:
"Embedded systems should enable hugepages only inside madvise regions
to eliminate any risk of wasting any precious byte of memory and to
only run faster." [1]
[1] https://www.kernel.org/doc/Documentation/vm/transhuge.txt
Diffstat (limited to 'rootdir')
-rwxr-xr-x | rootdir/etc/init.qcom.sh | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/rootdir/etc/init.qcom.sh b/rootdir/etc/init.qcom.sh index 46f5fa4..3004dfa 100755 --- a/rootdir/etc/init.qcom.sh +++ b/rootdir/etc/init.qcom.sh @@ -67,3 +67,14 @@ fi cp /firmware/image/modem_pr/mbn_ota.txt /data/vendor/radio/modem_config chown radio.radio /data/vendor/radio/modem_config/mbn_ota.txt echo 1 > /data/vendor/radio/copy_complete + +MemTotalStr=`cat /proc/meminfo | grep MemTotal` +MemTotal=${MemTotalStr:16:8} + +if [ $MemTotal -lt 5242880 ]; then + echo never > /sys/kernel/mm/transparent_hugepage/enabled + echo never > /sys/kernel/mm/transparent_hugepage/defrag +else + echo madvise > /sys/kernel/mm/transparent_hugepage/enabled + echo madvise > /sys/kernel/mm/transparent_hugepage/defrag +fi |