Skip to content

Commit 80621a1

Browse files
damentzkakra
authored andcommitted
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 Signed-off-by: Kai Krakow <kai@kaishome.de>
1 parent c77d0c8 commit 80621a1

2 files changed

Lines changed: 6 additions & 0 deletions

File tree

init/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,7 @@ config ZEN_INTERACTIVE
178178
Compact unevictable............: yes -> no
179179
Watermark boost factor.........: 1.5 -> 0
180180
Pageblock order................: 10 -> 3
181+
Swap-in readahead..............: 3 -> 0
181182

182183
--- EEVDF CPU Scheduler --------------------------------
183184

mm/swap.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1080,6 +1080,10 @@ void folio_batch_remove_exceptionals(struct folio_batch *fbatch)
10801080
*/
10811081
void __init swap_setup(void)
10821082
{
1083+
#ifdef CONFIG_ZEN_INTERACTIVE
1084+
/* Only swap-in pages requested, avoid readahead */
1085+
page_cluster = 0;
1086+
#else
10831087
unsigned long megs = totalram_pages() >> (20 - PAGE_SHIFT);
10841088

10851089
/* Use a smaller cluster for small-memory machines */
@@ -1091,4 +1095,5 @@ void __init swap_setup(void)
10911095
* Right now other parts of the system means that we
10921096
* _really_ don't want to cluster much more
10931097
*/
1098+
#endif
10941099
}

0 commit comments

Comments
 (0)