Skip to content

Commit 5dec840

Browse files
KanishkTheDerpkardebayan
authored andcommitted
mm: Tweak memory pressure for 3/4GB RAM devices
• AOSP’s Lighter Memory Footprint: Stock Android (AOSP) has fewer background processes than MIUI, HyperOS. A higher value (`20`) reduces unnecessary app/process killing, improving multitasking. • Reduces App Reloads: With `20`, the kernel waits longer before reclaiming memory. Apps stay cached in RAM longer, reducing reload times when switching between them. • Safer for Low-Memory Devices: On a 4GB RAM device, setting this too high (e.g., `50`) could risk out-of-memory (OOM) crashes. `20` balances stability and performance. • Battery Efficiency: Fewer app reloads = fewer storage I/O operations, which is especially important for UFS storage longevity. | Scenario | watermark_scale_factor=10 (Xiaomi) | watermark_scale_factor=20 (AOSP) | |-------------------------|--------------------------------------|-------------------------------------| | App Background Limits | Kills apps quickly | Allows ~2x more apps in RAM | | UI Smoothness | Frequent stutters due to reclaim | Smoother multitasking | | Battery Impact | Higher CPU usage from app reloads | Lower CPU/storage I/O | [TogoFire]: Note: lahaina is 8/12GB RAM. For phones with more RAM, we can tweak the memory settings a bit to make multitasking smoother. Here are some good starting points, but remember to test and adjust based on your own experience: 4GB RAM: 20 6GB RAM: 25-30 8GB RAM: 30-40 12GB RAM: 40-50 6/8GB RAM: 25-35 8/12GB RAM: 35-45 Change-Id: I45d25a23ceb5174769160d24c7f26f843c827c0c Signed-off-by: Kanishk <kanishkthederp@gmail.com> Signed-off-by: TogoFire <togofire@mailfence.com> [ryxpace: test with 30 for 6/8GB RAM] Signed-off-by: ryxpace <ryxpace@proton.me>
1 parent f74a7be commit 5dec840

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

mm/page_alloc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -356,7 +356,7 @@ compound_page_dtor * const compound_page_dtors[] = {
356356
*/
357357
int min_free_kbytes = 1024;
358358
int user_min_free_kbytes = -1;
359-
int watermark_scale_factor = 10;
359+
int watermark_scale_factor = 20;
360360

361361
/*
362362
* Extra memory for the system to try freeing. Used to temporarily

0 commit comments

Comments
 (0)