From e3afdec765f5277bbd3b2196e0facb8b428fb9d2 Mon Sep 17 00:00:00 2001 From: Steven Barrett Date: Mon, 5 Sep 2022 11:35:20 -0500 Subject: ZEN: INTERACTIVE: mm/swap: Disable swap-in readahead Per an [issue][1] on the chromium project, swap-in readahead causes more jank than not. This might be caused by poor optimization on the swapping code, or the fact under memory pressure, we're pulling in pages we don't need, causing more swapping. Either way, this is mainline/upstream to Chromium, and ChromeOS developers care a lot about system responsiveness. Lets implement the same change so Zen Kernel users benefit. [1]: https://bugs.chromium.org/p/chromium/issues/detail?id=263561 --- init/Kconfig | 1 + mm/swap.c | 5 +++++ 2 files changed, 6 insertions(+) --- a/init/Kconfig +++ b/init/Kconfig @@ -183,6 +183,7 @@ config ZEN_INTERACTIVE Background-reclaim hugepages...: no -> yes Compact unevictable............: yes -> no Watermark boost factor.........: 1.5 -> 0 + Swap-in readahead..............: 3 -> 0 --- EEVDF CPU Scheduler -------------------------------- --- a/mm/swap.c +++ b/mm/swap.c @@ -1091,6 +1091,10 @@ static const struct ctl_table swap_sysct */ void __init swap_setup(void) { +#ifdef CONFIG_ZEN_INTERACTIVE + /* Only swap-in pages requested, avoid readahead */ + page_cluster = 0; +#else unsigned long megs = totalram_pages() >> (20 - PAGE_SHIFT); /* Use a smaller cluster for small-memory machines */ @@ -1102,6 +1106,7 @@ void __init swap_setup(void) * Right now other parts of the system means that we * _really_ don't want to cluster much more */ +#endif register_sysctl_init("vm", swap_sysctl_table); }