From: David Rientjes <rientjes@google.com>
To: Andrew Morton <akpm@linux-foundation.org>,
Holger Kiehl <Holger.Kiehl@dwd.de>
Cc: Christoph Lameter <cl@linux.com>,
Rafael Aquini <aquini@redhat.com>,
Vlastimil Babka <vbabka@suse.cz>, Michal Hocko <mhocko@suse.cz>,
Mel Gorman <mgorman@suse.de>,
linux-kernel@vger.kernel.org, linux-mm@kvack.org
Subject: [patch v2] mm, page_alloc: make first_page visible before PageTail
Date: Tue, 4 Feb 2014 16:22:53 -0800 (PST) [thread overview]
Message-ID: <alpine.DEB.2.02.1402041621350.14962@chino.kir.corp.google.com> (raw)
In-Reply-To: <alpine.DEB.2.02.1402041613450.14962@chino.kir.corp.google.com>
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>
---
v2: with commentary, per checkpatch
mm/page_alloc.c | 4 +++-
1 file changed, 3 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,11 @@ 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;
+ /* Make sure p->first_page is always valid for PageTail() */
+ smp_wmb();
+ __SetPageTail(p);
}
}
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
next prev parent reply other threads:[~2014-02-05 0:22 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <alpine.LRH.2.02.1401312037340.6630@diagnostix.dwd.de>
2014-02-03 12:20 ` Need help in bug in isolate_migratepages_range Michal Hocko
2014-02-03 14:29 ` Holger Kiehl
2014-02-03 16:20 ` Michal Hocko
2014-02-03 16:52 ` Vlastimil Babka
2014-02-04 0:06 ` David Rientjes
2014-02-04 7:17 ` Holger Kiehl
2014-02-05 0:02 ` [patch] mm, page_alloc: make first_page visible before PageTail David Rientjes
2014-02-05 0:06 ` Andrew Morton
2014-02-05 0:14 ` David Rientjes
2014-02-05 0:22 ` David Rientjes [this message]
2014-02-05 8:42 ` [patch v2] " Michal Hocko
2014-02-12 9:00 ` [patch -mm] mm: close PageTail race David Rientjes
2014-02-03 19:50 ` Need help in bug in isolate_migratepages_range Holger Kiehl
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=alpine.DEB.2.02.1402041621350.14962@chino.kir.corp.google.com \
--to=rientjes@google.com \
--cc=Holger.Kiehl@dwd.de \
--cc=akpm@linux-foundation.org \
--cc=aquini@redhat.com \
--cc=cl@linux.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mgorman@suse.de \
--cc=mhocko@suse.cz \
--cc=vbabka@suse.cz \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox