linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [RFC PATCH] mm: use ACCESS_ONCE in page_cpupid_xchg_last()
@ 2016-12-05  8:23 Xishi Qiu
  2016-12-05  8:31 ` Christian Borntraeger
  2016-12-06  1:53 ` [RFC PATCH v3] mm: use READ_ONCE " Xishi Qiu
  0 siblings, 2 replies; 16+ messages in thread
From: Xishi Qiu @ 2016-12-05  8:23 UTC (permalink / raw)
  To: Andrew Morton, Mel Gorman, Yaowei Bai; +Cc: Linux MM, LKML, Yisheng Xie

By reading the code, I find the following code maybe optimized by
compiler, maybe page->flags and old_flags use the same register,
so use ACCESS_ONCE in page_cpupid_xchg_last() to fix the problem.

Signed-off-by: Xishi Qiu <qiuxishi@huawei.com>
---
 mm/mmzone.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mm/mmzone.c b/mm/mmzone.c
index 5652be8..e0b698e 100644
--- a/mm/mmzone.c
+++ b/mm/mmzone.c
@@ -102,7 +102,7 @@ int page_cpupid_xchg_last(struct page *page, int cpupid)
 	int last_cpupid;
 
 	do {
-		old_flags = flags = page->flags;
+		old_flags = flags = ACCESS_ONCE(page->flags);
 		last_cpupid = page_cpupid_last(page);
 
 		flags &= ~(LAST_CPUPID_MASK << LAST_CPUPID_PGSHIFT);
-- 
1.8.3.1


--
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>

^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2016-12-07 22:16 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-12-05  8:23 [RFC PATCH] mm: use ACCESS_ONCE in page_cpupid_xchg_last() Xishi Qiu
2016-12-05  8:31 ` Christian Borntraeger
2016-12-05  8:50   ` Christian Borntraeger
2016-12-05  9:22     ` Xishi Qiu
2016-12-05  9:26     ` [RFC PATCH v2] " Xishi Qiu
2016-12-05  9:44       ` Christian Borntraeger
2016-12-06  1:53 ` [RFC PATCH v3] mm: use READ_ONCE " Xishi Qiu
2016-12-07  8:39   ` Vlastimil Babka
2016-12-07  8:43   ` Michal Hocko
2016-12-07  8:48     ` Vlastimil Babka
2016-12-07  8:58       ` Michal Hocko
2016-12-07  9:29         ` Vlastimil Babka
2016-12-07  9:40           ` Christian Borntraeger
2016-12-07  9:59             ` Michal Hocko
2016-12-07 10:03               ` Christian Borntraeger
2016-12-07 22:16                 ` Rasmus Villemoes

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox