summaryrefslogtreecommitdiff
path: root/mm/page_alloc.c
diff options
context:
space:
mode:
authorVinayak Menon <vinmenon@codeaurora.org>2017-03-31 11:13:06 +1100
committerVinayak Menon <vinmenon@codeaurora.org>2017-04-14 23:43:05 +0530
commit49118fe6a32a49d198128a6dd1d6bfd0e3b189f8 (patch)
tree33b2a80dfe6d7e81f17ab2d0da76278370be0793 /mm/page_alloc.c
parent2c00b603db67af40aa0b02c834cc58fec98d3023 (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. Link: http://lkml.kernel.org/r/1490358246-11001-1-git-send-email-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> [vinmenon@codeaurora.org: resolve trivial merge conflicts. Remove the redundant free pages RO feature from the page_poison.c file which is the reason for conflicts + squash the addendum commit 40961ef8d65f51093bc94de110b97b590b6b9275 ('mm-enable-page-poisoning-early-at-boot-v2')] Git-commit: c5b7cd344fd6341e6db79e55c0f1f4d1d9c67a7e Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git Change-Id: I1bb1f99d3a2e1135131911905e0916c837ba9d8a Signed-off-by: Vinayak Menon <vinmenon@codeaurora.org>
Diffstat (limited to 'mm/page_alloc.c')
-rw-r--r--mm/page_alloc.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index a4cfa64634b4..170c1486e5c9 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -1397,24 +1397,21 @@ static inline int check_new_page(struct page *page)
return 0;
}
-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();
}
static int prep_new_page(struct page *page, unsigned int order, gfp_t gfp_flags,
int alloc_flags)
{
int i;
- bool poisoned = true;
for (i = 0; i < (1 << order); i++) {
struct page *p = page + i;
if (unlikely(check_new_page(p)))
return 1;
- if (poisoned)
- poisoned &= page_is_poisoned(p);
}
set_page_private(page, 0);
@@ -1425,7 +1422,7 @@ static int prep_new_page(struct page *page, unsigned int order, gfp_t gfp_flags,
kernel_map_pages(page, 1 << order, 1);
kernel_poison_pages(page, 1 << order, 1);
- 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);