mm: enable page poisoning early at boot
Subsystems (3)
[email protected]
maintainerPATCH 61/102 mm: enable page poisoning early at boot
From: Vinayak Menon <[email protected]>
Subject: mm: enable page poisoning early at boot
On SPARSEMEM systems page poisoning is enabled after buddy is up, because of the dependency on page extension init. This causes the pages released by free_all_bootmem not to be poisoned. This either delays or misses the identification of some issues because the pages have to undergo another cycle of alloc-free-alloc for any corruption to be detected.
Enable page poisoning early by getting rid of the PAGE_EXT_DEBUG_POISON flag. Since all the free pages will now be poisoned, the flag need not be verified before checking the poison during an alloc.
[[email protected]: fix Kconfig]
Signed-off-by Vinayak Menon <[email protected]>
Acked-by Laura Abbott <[email protected]>
Tested-by Laura Abbott <[email protected]>
Cc Joonsoo Kim <[email protected]>
Cc Michal Hocko <[email protected]>
Cc Akinobu Mita <[email protected]>
Signed-off-by Andrew Morton <[email protected]>
---
include/linux/mm.h | 1 mm/Kconfig.debug | 1 mm/page_alloc.c | 13 +------ mm/page_ext.c | 13 +------ mm/page_poison.c | 77 ++++++------------------------------------- 5 files changed, 17 insertions(+), 88 deletions(-)
include/linux/mm.h renamed from include/linux/mm.h~mm-enable-page-poisoning-early-at-boot +0 -1
@@ -2487,7 +2487,6 @@ extern long copy_huge_page_from_user(str#endif /* CONFIG_TRANSPARENT_HUGEPAGE || CONFIG_HUGETLBFS */ extern struct page_ext_operations debug_guardpage_ops; -extern struct page_ext_operations page_poisoning_ops;#ifdef CONFIG_DEBUG_PAGEALLOC extern unsigned int _debug_guardpage_minorder;
mm/Kconfig.debug renamed from mm/Kconfig.debug~mm-enable-page-poisoning-early-at-boot +0 -1
@@ -42,7 +42,6 @@ config DEBUG_PAGEALLOC_ENABLE_DEFAULT config PAGE_POISONING bool "Poison pages after freeing" - select PAGE_EXTENSION select PAGE_POISONING_NO_SANITY if HIBERNATION ---help--- Fill the pages with poison patterns after free_pages() and verify
mm/page_alloc.c renamed from mm/page_alloc.c~mm-enable-page-poisoning-early-at-boot +3 -10
@@ -1689,10 +1689,10 @@ static inline int check_new_page(structreturn 1 ; } -static inline bool free_pages_prezeroed (bool poisoned) +static inline bool free_pages_prezeroed (void ) {return IS_ENABLED (CONFIG_PAGE_POISONING_ZERO ) && -page_poisoning_enabled () && poisoned; +page_poisoning_enabled (); }#ifdef CONFIG_DEBUG_VM
@@ -1746,17 +1746,10 @@ static void prep_new_page(struct page *p unsigned int alloc_flags) {int i; -bool poisoned = true; - -for (i =0 ; i < (1 << order); i++) { -struct page *p = page + i; -if (poisoned) - poisoned &=page_is_poisoned (p); - }post_alloc_hook (page, order, gfp_flags); -if (!free_pages_prezeroed (poisoned) && (gfp_flags & __GFP_ZERO)) +if (!free_pages_prezeroed () && (gfp_flags & __GFP_ZERO))for (i =0 ; i < (1 << order); i++)clear_highpage (page + i);
mm/page_ext.c renamed from mm/page_ext.c~mm-enable-page-poisoning-early-at-boot +2 -11
@@ -59,9 +59,6 @@static struct page_ext_operations *page_ext_ops[] = { &debug_guardpage_ops, -#ifdef CONFIG_PAGE_POISONING - &page_poisoning_ops, -#endif #ifdef CONFIG_PAGE_OWNER &page_owner_ops, #endif
@@ -127,15 +124,12 @@ struct page_ext *lookup_page_ext(structstruct page_ext *base; base =NODE_DATA (page_to_nid (page))->node_page_ext; -#if defined(CONFIG_DEBUG_VM ) || defined(CONFIG_PAGE_POISONING ) +#if defined(CONFIG_DEBUG_VM )/* * The sanity checks the page allocator does upon freeing a * page can reach here before the page_ext arrays are * allocated when feeding a range of pages to the allocator * for the first time during bootup or memory hotplug. -* -* This check is also necessary for ensuring page poisoning -* works as expected when enabled */ if (unlikely (!base))return NULL ;
@@ -204,15 +198,12 @@ struct page_ext *lookup_page_ext(struct {unsigned long pfn =page_to_pfn (page);struct mem_section *section =__pfn_to_section (pfn); -#if defined(CONFIG_DEBUG_VM ) || defined(CONFIG_PAGE_POISONING ) +#if defined(CONFIG_DEBUG_VM )/* * The sanity checks the page allocator does upon freeing a * page can reach here before the page_ext arrays are * allocated when feeding a range of pages to the allocator * for the first time during bootup or memory hotplug. -* -* This check is also necessary for ensuring page poisoning -* works as expected when enabled */ if (!section->page_ext)return NULL ;
mm/page_poison.c renamed from mm/page_poison.c~mm-enable-page-poisoning-early-at-boot +7 -63
93 lines not on this page · raw message