[RESEARCH] Memory Management (DHA?)

Search This thread

swa100

Senior Member
Dec 22, 2012
780
113
So.. I'm reading different stories. Some say use dha, some say use fha. Some say it doesn't work, some say it work. Can anyone clear this up for me?

Sent from my SM-G920F using Tapatalk
 

GZA1337

Senior Member
Jun 15, 2011
151
28
Vienna
So.. I'm reading different stories. Some say use dha, some say use fha. Some say it doesn't work, some say it work. Can anyone clear this up for me?
Sent from my SM-G920F using Tapatalk

my s6 is on 5.0.2 and I am using modified dha values. Played some days testing and ended up with these values that I use for 2 month now. I definitely feel improvement of multitasking. The most important line is the "low mem killer" line. I would not go below 0.990 because of slowdown after some time...

ro.config.dha_cached_max=12
ro.config.dha_empty_max=30
ro.config.dha_th_rate=1.4
ro.config.dha_lmk_scale=0.990
ro.config.sdha_apps_bg_max=50
ro.config.ldha_spc_enable=false (came with my stock rom)

just add these lines at the end of the bulid prop and test if for yourself. It does not matter if there are duplicates of these lines but you can delete them of course.
 
  • Like
Reactions: kpirnie

kpirnie

Recognized Contributor
Aug 29, 2012
8,763
7,529
48
MA
kevinpirnie.com
Google Pixel 6 Pro
OnePlus 11
Can someone post more FHA tweaks ??? I only see DHA here :(

this thread is 245 posts.... i bet you 75% of those are actually on topic.... of which there is a good 50/50 split between fha and dha... 80% of those have peoples configurations.

use the damn search and open your eyes.

---------- Post added at 11:06 AM ---------- Previous post was at 11:05 AM ----------

this thread is 245 posts.... i bet you 75% of those are actually on topic.... of which there is a good 50/50 split between fha and dha... 80% of those have peoples configurations.

use the damn search and open your eyes.
Can someone post more FHA tweaks ??? I only see DHA here :(

u also need to come up with your own optimal settings. What works good for oner does not mean it will work goid for all.
 
  • Like
Reactions: mikeyinid

torhect

Senior Member
Nov 4, 2014
627
52
Code:
ro.config.fha_enable=true
ro.sys.fw.use_trim_settings=true 
ro.sys.fw.empty_app_percent=50 
ro.sys.fw.trim_empty_percent=100 
ro.sys.fw.trim_cache_percent=100
ro.sys.fw.bservice_enable=true 
ro.sys.fw.bservice_limit=5 
ro.sys.fw.bservice_age=5000
ro.sys.fw.trim_enable_memory=128000000

Hey what is the Best value for ro.sys.fw.trim_enable_memory? To Takeshi full advantage of 4gb of ram?
 

torhect

Senior Member
Nov 4, 2014
627
52
As many of you may or may not have seen, there has finally been some progress made regarding S6 memory management issues. There is a long winded thread HERE with lots of reports of bootloops, lots of the same question being asked over, and over. I just wanted to share what I found, get more knowledgeable eyes on it, and hopefully get this memory issue ironed out.​




Code:
Here is most of what I found regarding DHA:
ProcessList.smali

ro.config.dha_cached_max=6
ro.config.dha_cached_min=2
ro.config.dha_empty_init=30
ro.config.dha_empty_min=6
ro.config.dha_empty_max=30
ro.config.oomminfree_high=73728,92160,110592,129024,147456,184320
ro.config.ldha_es_enable=false
ro.config.ldha_spc_enable=true
sys.config.s_dha_margin
ro.config.64bit_lmk_enable=false
ro.config.dha_ils_enable=true
ro.config.dha_ils_dyna_lmk=false
ro.config.dha_ils_rate=1.5
sys.config.s_dha_bg_max
ro.config.dha_ils_sdha_rate=1.8
ro.config.dha_whitelist_enable=2
ro.config.dha_goldenlist_enable=0
ro.config.dha_HEC_enable=0
ro.config.dha_frag_enable=0
ro.config.dha_lmk_scale=-1
ro.config.dha_lmk_rate=1
ro.config.dha_dyna_lmk_enable=false
ro.config.sdha_margin_min_low=20
ro.config.sdha_margin_min_high=60
ro.config.sdha_apps_bg_max=40
ro.config.sdha_apps_bg_min=4
ro.config.dha_step
ro.config.dha_th_rate
ro.config.dha_th_level=15
ro.config.dha_defend_th_level=3
ro.config.dha_increase_th
ro.config.dha_ils_dynamic_lmk_flag
ro.config.dha_whl_key

ActivityManagerService.smali

ro.config.dha_whl_key=255
ro.config.dha_gdl_key=63

Here is what I recommend:
For stabilty, a slight improvement over stock:
Code:
#DHA
ro.config.dha_cached_max=9
ro.config.dha_lmk_scale=1.5
ro.config.sdha_apps_bg_max=50

This should be stable with multi tasking improved over stock
Code:
#DHA
ro.config.dha_cached_max=12
ro.config.dha_empty_max=32
ro.config.dha_empty_init=32
ro.config.dha_lmk_scale=0.990
ro.config.sdha_apps_bg_max=60

This will multi task very well, stability over time is doubtful...
Code:
#DHA
ro.config.dha_cached_max=20
ro.config.dha_empty_max=36
ro.config.dha_empty_init=36
ro.config.dha_lmk_scale=0.545
ro.config.sdha_apps_bg_max=70

And, for those of you that want to have every app on your phone open...
Code:
#DHA
ro.config.dha_cached_max=20
ro.config.dha_empty_max=42
ro.config.dha_empty_init=42
ro.config.dha_lmk_scale=0.272
ro.config.sdha_apps_bg_max=90

Do you know Why I cannot change ooem lmk ? I tried to changed the 6 state of memory and when I wanted to apply it return to the stock values :(
 

Attachments

  • Screenshot_20160820-105606.jpg
    Screenshot_20160820-105606.jpg
    178.4 KB · Views: 252

marceloz5

Senior Member
Feb 24, 2016
236
41
These ones are geared towards multi tasking. They do a very good job. I can't guarantee stability over time.
#DHA
ro.config.dha_cached_max=20
ro.config.dha_empty_max=36
ro.config.dha_empty_init=36
ro.config.dha_th_rate=0.75
ro.config.dha_lmk_scale=0.272
ro.config.sdha_apps_bg_max=90
this tweaks affect battery?
 

Top Liked Posts

  • There are no posts matching your filters.
  • 40
    As many of you may or may not have seen, there has finally been some progress made regarding S6 memory management issues. There is a long winded thread HERE with lots of reports of bootloops, lots of the same question being asked over, and over. I just wanted to share what I found, get more knowledgeable eyes on it, and hopefully get this memory issue ironed out.​


    After way to many hours of testing and messing with this stuff, here is what I know.


    ro.config.dha_cached_max=20 <~~~ This line is pretty obvious in what it does. This is the limit for cached apps/services

    ro.config.dha_empty_max=36 <~~~ Same here, this is the limit of empty apps/services (Do some research on LMK if you don't know what this means)

    ro.config.dha_empty_init=36 <~~~ I'm not sure what this line does exactly but the value here corresponds the the empty_max value

    ro.config.dha_th_rate=0.75 <~~~ I'm not entirely sure what this line does yet, it may not even be needed

    ro.config.dha_lmk_scale=0.272 <~~~ This is the line that sets the LMK values. These override anything set in the ROM or kernel. This is probably the most important line that I actually understand

    ro.config.sdha_apps_bg_max=90 <~~~ This line sets the total overall background apps/processes allowed

    Here are what I've found the lmk_scale values to represent:

    0.272 = 18, 25, 31, 40, 46, 55
    0.545 = 29, 38, 46, 56, 65, 79
    0.767 = 38, 48, 58, 70, 80, 99
    0.990 = 47, 59, 71, 83, 95, 119
    1.2 = 56, 69, 83, 96, 109, 137
    1.5 = 68, 84, 100, 114, 130, 164


    It's been my understanding that with arm64 devices with 2+ GB RAM, the LMK values are set lower as mostly a fail safe, and we let the cached, empty, and bg limits do the work. That is where the issues we are having with instability over time come in. Finding the best values for each property has proven to be difficult to say the least. Anyway, I just wanted to share what I know. Now we're all on the same page.

    Code:
    Here is most of what I found regarding DHA:
    ProcessList.smali
    
    ro.config.dha_cached_max=6
    ro.config.dha_cached_min=2
    ro.config.dha_empty_init=30
    ro.config.dha_empty_min=6
    ro.config.dha_empty_max=30
    ro.config.oomminfree_high=73728,92160,110592,129024,147456,184320
    ro.config.ldha_es_enable=false
    ro.config.ldha_spc_enable=true
    sys.config.s_dha_margin
    ro.config.64bit_lmk_enable=false
    ro.config.dha_ils_enable=true
    ro.config.dha_ils_dyna_lmk=false
    ro.config.dha_ils_rate=1.5
    sys.config.s_dha_bg_max
    ro.config.dha_ils_sdha_rate=1.8
    ro.config.dha_whitelist_enable=2
    ro.config.dha_goldenlist_enable=0
    ro.config.dha_HEC_enable=0
    ro.config.dha_frag_enable=0
    ro.config.dha_lmk_scale=-1
    ro.config.dha_lmk_rate=1
    ro.config.dha_dyna_lmk_enable=false
    ro.config.sdha_margin_min_low=20
    ro.config.sdha_margin_min_high=60
    ro.config.sdha_apps_bg_max=40
    ro.config.sdha_apps_bg_min=4
    ro.config.dha_step
    ro.config.dha_th_rate
    ro.config.dha_th_level=15
    ro.config.dha_defend_th_level=3
    ro.config.dha_increase_th
    ro.config.dha_ils_dynamic_lmk_flag
    ro.config.dha_whl_key
    
    ActivityManagerService.smali
    
    ro.config.dha_whl_key=255
    ro.config.dha_gdl_key=63

    Here is what I recommend:
    For stabilty, a slight improvement over stock:
    Code:
    #DHA
    ro.config.dha_cached_max=9
    ro.config.dha_lmk_scale=1.5
    ro.config.sdha_apps_bg_max=50

    This should be stable with multi tasking improved over stock
    Code:
    #DHA
    ro.config.dha_cached_max=12
    ro.config.dha_empty_max=32
    ro.config.dha_empty_init=32
    ro.config.dha_lmk_scale=0.990
    ro.config.sdha_apps_bg_max=60

    This will multi task very well, stability over time is doubtful...
    Code:
    #DHA
    ro.config.dha_cached_max=20
    ro.config.dha_empty_max=36
    ro.config.dha_empty_init=36
    ro.config.dha_lmk_scale=0.545
    ro.config.sdha_apps_bg_max=70

    And, for those of you that want to have every app on your phone open...
    Code:
    #DHA
    ro.config.dha_cached_max=20
    ro.config.dha_empty_max=42
    ro.config.dha_empty_init=42
    ro.config.dha_lmk_scale=0.272
    ro.config.sdha_apps_bg_max=90
    8
    For me these settings are working the best:

    Code:
    #DHA
    ro.config.dha_cached_max=15
    ro.config.dha_cached_min=4
    ro.config.dha_empty_max=36
    ro.config.dha_empty_min=9
    ro.config.dha_empty_init=36
    ro.config.dha_lmk_scale=0.545
    ro.config.dha_update_max_count=5
    ro.config.dha_step=2
    ro.config.dha_th_rate=1.4
    ro.config.dha_defend_th_level=0
    ro.config.64bit_lmk_enable=true
    ro.config.sdha_apps_bg_max=70
    ro.config.sdha_apps_bg_min=8
    ro.config.dha_ils_enable=true
    ro.config.dha_ils_dyna_lmk=true
    ro.config.dha_ils_rate=1.5

    I feel a nice speed improvement with these settings, and also multi-tasking is working perfectly. And doesn't slow down after some time for me.
    8
    Here, this is what I know...

    After way to many hours of testing and messing with this stuff, here is what I know.


    ro.config.dha_cached_max=20 <~~~ This line is pretty obvious in what it does. This is the limit for cached apps/services

    ro.config.dha_empty_max=36 <~~~ Same here, this is the limit of empty apps/services (Do some research on LMK if you don't know what this means)

    ro.config.dha_empty_init=36 <~~~ I'm not sure what this line does exactly but the value here corresponds the the empty_max value

    ro.config.dha_th_rate=0.75 <~~~ I'm not entirely sure what this line does yet, it may not even be needed

    ro.config.dha_lmk_scale=0.272 <~~~ This is the line that sets the LMK values. These override anything set in the ROM or kernel. This is probably the most important line that I actually understand

    ro.config.sdha_apps_bg_max=90 <~~~ This line sets the total overall background apps/processes allowed

    Here are what I've found the lmk_scale values to represent:

    0.272 = 18, 25, 31, 40, 46, 55
    0.545 = 29, 38, 46, 56, 65, 79
    0.767 = 38, 48, 58, 70, 80, 99
    0.990 = 47, 59, 71, 83, 95, 119
    1.2 = 56, 69, 83, 96, 109, 137
    1.5 = 68, 84, 100, 114, 130, 164

    These values are in MB

    It's been my understanding that with arm64 devices with 2+ GB RAM, the LMK values are set lower as mostly a fail safe, and we let the cached, empty, and bg limits do the work. That is where the issues we are having with instability over time come in. Finding the best values for each property has proven to be difficult to say the least. Anyway, I just wanted to share what I know. Now we're all on the same page.
    8
    I think I found a solution to the device getting sluggish over time. If you go into application manager and the running apps tab, hit menu and show cached apps. You'll see that you're probably always in the red. That seems to be the case with every set I've posted so far. With what i'm testing now, it's always in the blue, which is what you wanna see. And it's still multi tasking like a boss. So, try these values:
    Code:
    ro.config.dha_cached_max=15
    ro.config.dha_cached_min=4
    ro.config.dha_empty_max=36
    ro.config.dha_empty_min=9
    ro.config.dha_empty_init=36
    ro.config.dha_lmk_scale=0.990
    ro.config.dha_th_rate=1.83
    ro.config.sdha_apps_bg_max=70
    ro.config.sdha_apps_bg_min=8
    ro.config.dha_ils_enable=true
    ro.config.dha_ils_dyna_lmk=true
    ro.config.dha_ils_rate=1.5
    5
    Great work!
    I just added these FHA lines and deleted all the DHA ones (there are three DHA lines in Unibase OG8).
    After a reboot the phone has 900MB free RAM (which I don't care about).
    What surprised me is that after having opened 20+ apps after Chrome, when I switched back to it, Chrome did not reload but directly showed the page!!!
    Then I continued to open more apps (about 35 in total), the first few apps were killed.
    This is great improvement to stock!
    Thank you @mikeyinid!!!

    Applied FHA lines:

    Code:
    #FHA
    ro.config.fha_enable=true
    ro.sys.fw.use_trim_settings=true 
    ro.sys.fw.empty_app_percent=50 
    ro.sys.fw.trim_empty_percent=100 
    ro.sys.fw.trim_cache_percent=100
    ro.sys.fw.bservice_enable=true 
    ro.sys.fw.bservice_limit=5 
    ro.sys.fw.bservice_age=5000
    ro.sys.fw.trim_enable_memory=128000000