From 394ae0c10f1a73cc0b9a738e5e4c070076cc7727 Mon Sep 17 00:00:00 2001 From: "Jan Alexander Steffens (heftig)" Date: Mon, 27 Jan 2020 18:20:11 +0100 Subject: [PATCH] ZEN: INTERACTIVE: Disable compaction of unevictable pages 5.4: Disable compaction for unevictable memory. Compaction of running memory is a good thing. It's also required to properly allocate memory for large applications, like new processes in Chrome or make room for a large virtual machine. Unfortunately, the default configuration of Linux allows all memory to be compacted. This is a good thing for servers. An application running server side can tolerate micro stalls since the latency impact is almost not measurable (depending on the application, of course). But on a desktop configuration with X, Wayland, Gnome, KDE, etc, the dropped frames and lost input are very obvious. Lets prevent these applications from having their memory moved during compaction. Although compaction will take longer and new processes will take longer to spawn under high memory pressure / external memory fragmentation, the actual experience of the system will feel more responsive and consistent under these adverse conditions. --- init/Kconfig | 1 + mm/compaction.c | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/init/Kconfig b/init/Kconfig index d2a33590746478..2a9b0a5c1428a7 100644 --- a/init/Kconfig +++ b/init/Kconfig @@ -88,6 +88,7 @@ config ZEN_INTERACTIVE Mem dirty before bg writeback..: 10 % -> 20 % Mem dirty before sync writeback: 20 % -> 50 % + Compact unevictable pages......: yes -> no config BROKEN bool diff --git a/mm/compaction.c b/mm/compaction.c index 672d3c78c6abfc..44e0f26cb2a738 100644 --- a/mm/compaction.c +++ b/mm/compaction.c @@ -1590,7 +1590,11 @@ typedef enum { * Allow userspace to control policy on scanning the unevictable LRU for * compactable pages. */ +#ifdef CONFIG_ZEN_INTERACTIVE +int sysctl_compact_unevictable_allowed __read_mostly = 0; +#else int sysctl_compact_unevictable_allowed __read_mostly = 1; +#endif static inline void update_fast_start_pfn(struct compact_control *cc, unsigned long pfn)