summarylogtreecommitdiffstats
path: root/0022-ZEN-INTERACTIVE-Enable-background-reclaim-of-hugepag.patch
diff options
context:
space:
mode:
Diffstat (limited to '0022-ZEN-INTERACTIVE-Enable-background-reclaim-of-hugepag.patch')
-rw-r--r--0022-ZEN-INTERACTIVE-Enable-background-reclaim-of-hugepag.patch66
1 files changed, 66 insertions, 0 deletions
diff --git a/0022-ZEN-INTERACTIVE-Enable-background-reclaim-of-hugepag.patch b/0022-ZEN-INTERACTIVE-Enable-background-reclaim-of-hugepag.patch
new file mode 100644
index 000000000000..fa1cba6a0238
--- /dev/null
+++ b/0022-ZEN-INTERACTIVE-Enable-background-reclaim-of-hugepag.patch
@@ -0,0 +1,66 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: "Jan Alexander Steffens (heftig)" <jan.steffens@gmail.com>
+Date: Mon, 27 Jan 2020 18:21:09 +0100
+Subject: [PATCH] ZEN: INTERACTIVE: Enable background reclaim of hugepages
+
+Use [defer+madvise] as default khugepaged defrag strategy:
+
+For some reason, the default strategy to respond to THP fault fallbacks
+is still just madvise, meaning stall if the program wants transparent
+hugepages, but don't trigger a background reclaim / compaction if THP
+begins to fail allocations. This creates a snowball affect where we
+still use the THP code paths, but we almost always fail once a system
+has been active and busy for a while.
+
+The option "defer" was created for interactive systems where THP can
+still improve performance. If we have to fallback to a regular page due
+to an allocation failure or anything else, we will trigger a background
+reclaim and compaction so future THP attempts succeed and previous
+attempts eventually have their smaller pages combined without stalling
+running applications.
+
+We still want madvise to stall applications that explicitely want THP,
+so defer+madvise _does_ make a ton of sense. Make it the default for
+interactive systems, especially if the kernel maintainer left
+transparent hugepages on "always".
+
+Reasoning and details in the original patch: https://lwn.net/Articles/711248/
+---
+ init/Kconfig | 4 ++++
+ mm/huge_memory.c | 4 ++++
+ 2 files changed, 8 insertions(+)
+
+diff --git a/init/Kconfig b/init/Kconfig
+index 450355b8aa2a..a77e78d1c9eb 100644
+--- a/init/Kconfig
++++ b/init/Kconfig
+@@ -117,6 +117,10 @@ config ZEN_INTERACTIVE
+
+ Default scheduler.........: mq-deadline -> bfq
+
++ --- Virtual Memory Subsystem ---------------------------
++
++ Background-reclaim hugepages...: no -> yes
++
+ config BROKEN
+ bool
+
+diff --git a/mm/huge_memory.c b/mm/huge_memory.c
+index 406a3c28c026..3538923b48ab 100644
+--- a/mm/huge_memory.c
++++ b/mm/huge_memory.c
+@@ -54,7 +54,11 @@ unsigned long transparent_hugepage_flags __read_mostly =
+ #ifdef CONFIG_TRANSPARENT_HUGEPAGE_MADVISE
+ (1<<TRANSPARENT_HUGEPAGE_REQ_MADV_FLAG)|
+ #endif
++#ifdef CONFIG_ZEN_INTERACTIVE
++ (1<<TRANSPARENT_HUGEPAGE_DEFRAG_KSWAPD_OR_MADV_FLAG)|
++#else
+ (1<<TRANSPARENT_HUGEPAGE_DEFRAG_REQ_MADV_FLAG)|
++#endif
+ (1<<TRANSPARENT_HUGEPAGE_DEFRAG_KHUGEPAGED_FLAG)|
+ (1<<TRANSPARENT_HUGEPAGE_USE_ZERO_PAGE_FLAG);
+
+--
+2.35.1
+