mm-page_alloc-ignore-init_on_free=1-for-debug_pagealloc=1.patch removed from -mm tree
The patch titled
Subject: mm: page_alloc: ignore init_on_free=1 for debug_pagealloc=1
has been removed from the -mm tree. Its filename was
mm-page_alloc-ignore-init_on_free=1-for-debug_pagealloc=1.patch
This patch was dropped because it was merged into mainline or a subsystem tree
------------------------------------------------------
From: Sergei Trofimovich <[email protected]>
Subject: mm: page_alloc: ignore init_on_free=1 for debug_pagealloc=1
On !ARCH_SUPPORTS_DEBUG_PAGEALLOC (like ia64) debug_pagealloc=1 implies page_poison=on:
if (page_poisoning_enabled() ||
(!IS_ENABLED(CONFIG_ARCH_SUPPORTS_DEBUG_PAGEALLOC) &&
debug_pagealloc_enabled()))
static_branch_enable(&_page_poisoning_enabled);page_poison=on needs to override init_on_free=1.
Before the change it did not work as expected for the following case:
- have PAGE_POISONING=y
- have page_poison unset
- have !ARCH_SUPPORTS_DEBUG_PAGEALLOC arch (like ia64)
- have init_on_free=1
- have debug_pagealloc=1
That way we get both keys enabled:
- static_branch_enable(&init_on_free);
- static_branch_enable(&_page_poisoning_enabled);
which leads to poisoned pages returned for __GFP_ZERO pages.
After the change we execute only:
- static_branch_enable(&_page_poisoning_enabled);
and ignore init_on_free=1.
---
mm/page_alloc.c | 30 +++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-)
mm/page_alloc.c renamed from mm/page_alloc.c~mm-page_alloc-ignore-init_on_free=1-for-debug_pagealloc=1 +17 -13
@@ -786,32 +786,36 @@ static inline void clear_page_guard(stru*/ void init_mem_debugging_and_hardening (void ) { +bool page_poisoning_requested = false; + +#ifdef CONFIG_PAGE_POISONING +/* +* Page poisoning is debug page alloc for some arches. If +* either of those options are enabled, enable poisoning. +*/ +if (page_poisoning_enabled () || + (!IS_ENABLED (CONFIG_ARCH_SUPPORTS_DEBUG_PAGEALLOC ) && +debug_pagealloc_enabled ())) { +static_branch_enable (&_page_poisoning_enabled); + page_poisoning_requested = true; + } +#endif +if (_init_on_alloc_enabled_early) { -if (page_poisoning_enabled ()) +if (page_poisoning_requested)pr_info ("mem auto-init: CONFIG_PAGE_POISONING is on, " "will take precedence over init_on_alloc\n" );else static_branch_enable (&init_on_alloc); }if (_init_on_free_enabled_early) { -if (page_poisoning_enabled ()) +if (page_poisoning_requested)pr_info ("mem auto-init: CONFIG_PAGE_POISONING is on, " "will take precedence over init_on_free\n" );else static_branch_enable (&init_on_free); } -#ifdef CONFIG_PAGE_POISONING -/* -* Page poisoning is debug page alloc for some arches. If -* either of those options are enabled, enable poisoning. -*/ -if (page_poisoning_enabled () || - (!IS_ENABLED (CONFIG_ARCH_SUPPORTS_DEBUG_PAGEALLOC ) && -debug_pagealloc_enabled ())) -static_branch_enable (&_page_poisoning_enabled); -#endif -#ifdef CONFIG_DEBUG_PAGEALLOC if (!debug_pagealloc_enabled ())return ;
_
Patches currently in -mm which might be from [email protected] are