lkml.org 
[lkml]   [2014]   [Feb]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[patch] mm, page_alloc: make first_page visible before PageTail
Commit bf6bddf1924e ("mm: introduce compaction and migration for ballooned 
pages") introduces page_count(page) into memory compaction which
dereferences page->first_page if PageTail(page).

Introduce a store memory barrier to ensure page->first_page is properly
initialized so that code that does page_count(page) on pages off the lru
always have a valid p->first_page.

Reported-by: Holger Kiehl <Holger.Kiehl@dwd.de>
Signed-off-by: David Rientjes <rientjes@google.com>
---
mm/page_alloc.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/mm/page_alloc.c b/mm/page_alloc.c
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -369,9 +369,10 @@ void prep_compound_page(struct page *page, unsigned long order)
__SetPageHead(page);
for (i = 1; i < nr_pages; i++) {
struct page *p = page + i;
- __SetPageTail(p);
set_page_count(p, 0);
p->first_page = page;
+ smp_wmb();
+ __SetPageTail(p);
}
}


\
 
 \ /
  Last update: 2014-02-05 01:41    [W:0.064 / U:0.096 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site