summaryrefslogtreecommitdiffstats
path: root/mm/page_alloc.c
diff options
context:
space:
mode:
authorVinayak Menon <vinmenon@codeaurora.org>2017-05-03 17:54:42 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2017-05-03 18:52:10 -0400
commitbd33ef3681359343863f2290aded182b0441edee (patch)
treee4575468fe495b08fe95c4aa8272895f843183b3 /mm/page_alloc.c
parent2872bb2d0a4952ffb721e703555cb73d40b2c2f0 (diff)
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. [vinmenon@codeaurora.org: fix Kconfig] Link: http://lkml.kernel.org/r/1490878002-14423-1-git-send-email-vinmenon@codeaurora.org Link: http://lkml.kernel.org/r/1490358246-11001-1-git-send-email-vinmenon@codeaurora.org Signed-off-by: Vinayak Menon <vinmenon@codeaurora.org> Acked-by: Laura Abbott <labbott@redhat.com> Tested-by: Laura Abbott <labbott@redhat.com> Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com> Cc: Michal Hocko <mhocko@suse.com> Cc: Akinobu Mita <akinobu.mita@gmail.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm/page_alloc.c')
-rw-r--r--mm/page_alloc.c13
1 files changed, 3 insertions, 10 deletions
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 465391811c2e..f1f225608413 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -1689,10 +1689,10 @@ static inline int check_new_page(struct page *page)
1689 return 1; 1689 return 1;
1690} 1690}
1691 1691
1692static inline bool free_pages_prezeroed(bool poisoned) 1692static inline bool free_pages_prezeroed(void)
1693{ 1693{
1694 return IS_ENABLED(CONFIG_PAGE_POISONING_ZERO) && 1694 return IS_ENABLED(CONFIG_PAGE_POISONING_ZERO) &&
1695 page_poisoning_enabled() && poisoned; 1695 page_poisoning_enabled();
1696} 1696}
1697 1697
1698#ifdef CONFIG_DEBUG_VM 1698#ifdef CONFIG_DEBUG_VM
@@ -1746,17 +1746,10 @@ static void prep_new_page(struct page *page, unsigned int order, gfp_t gfp_flags
1746 unsigned int alloc_flags) 1746 unsigned int alloc_flags)
1747{ 1747{
1748 int i; 1748 int i;
1749 bool poisoned = true;
1750
1751 for (i = 0; i < (1 << order); i++) {
1752 struct page *p = page + i;
1753 if (poisoned)
1754 poisoned &= page_is_poisoned(p);
1755 }
1756 1749
1757 post_alloc_hook(page, order, gfp_flags); 1750 post_alloc_hook(page, order, gfp_flags);
1758 1751
1759 if (!free_pages_prezeroed(poisoned) && (gfp_flags & __GFP_ZERO)) 1752 if (!free_pages_prezeroed() && (gfp_flags & __GFP_ZERO))
1760 for (i = 0; i < (1 << order); i++) 1753 for (i = 0; i < (1 << order); i++)
1761 clear_highpage(page + i); 1754 clear_highpage(page + i);
1762 1755