linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
*  [PATCH v2] mm/huge_memory: mark racy access on huge_anon_orders_always
@ 2024-05-15  2:47 xu.xin16
  0 siblings, 0 replies; only message in thread
From: xu.xin16 @ 2024-05-15  2:47 UTC (permalink / raw)
  To: akpm, david, linux-kernel, linux-mm, willy, ziy, shy828301
  Cc: yang.yang29, ran.xiaokai, lu.zhongjun, xu.xin16

From: Ran Xiaokai <ran.xiaokai@zte.com.cn>

huge_anon_orders_always is accessed lockless, it is better
to use the READ_ONCE() wrapper. This is not fixing any visible
bug, hopefully this can cease some KCSAN complains in the future.
Also do that for huge_anon_orders_madvise.

Signed-off-by: Ran Xiaokai <ran.xiaokai@zte.com.cn>
Acked-by: David Hildenbrand <david@redhat.com>
Reviewed-by: Lu Zhongjun <lu.zhongjun@zte.com.cn>
Reviewed-by: xu xin <xu.xin16@zte.com.cn>
Cc: Yang Yang <yang.yang29@zte.com.cn>
---
 include/linux/huge_mm.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/linux/huge_mm.h b/include/linux/huge_mm.h
index de0c89105076..cf7f671aa634 100644
--- a/include/linux/huge_mm.h
+++ b/include/linux/huge_mm.h
@@ -122,8 +122,8 @@ static inline bool hugepage_flags_enabled(void)
 	 * So we don't need to look at huge_anon_orders_inherit.
 	 */
 	return hugepage_global_enabled() ||
-	       huge_anon_orders_always ||
-	       huge_anon_orders_madvise;
+	       READ_ONCE(huge_anon_orders_always) ||
+	       READ_ONCE(huge_anon_orders_madvise);
 }

 static inline int highest_order(unsigned long orders)
-- 
2.15.2


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2024-05-15  2:48 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-05-15  2:47 [PATCH v2] mm/huge_memory: mark racy access on huge_anon_orders_always xu.xin16

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