linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mm: move bad zone checking before getting it
@ 2024-09-05  9:52 Wang Yibo
  2024-09-05 10:22 ` David Hildenbrand
  0 siblings, 1 reply; 6+ messages in thread
From: Wang Yibo @ 2024-09-05  9:52 UTC (permalink / raw)
  To: akpm; +Cc: linux-mm, linux-kernel, trivial, Wang Yibo

When flags from gfp_zone() has an error combination, VM_BUG_ON() should firt know it before use it.

Signed-off-by: Wang Yibo <wangyibo@uniontech.com>
---
 include/linux/gfp.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/include/linux/gfp.h b/include/linux/gfp.h
index f53f76e0b17e..ca61b2440ab3 100644
--- a/include/linux/gfp.h
+++ b/include/linux/gfp.h
@@ -133,10 +133,11 @@ static inline enum zone_type gfp_zone(gfp_t flags)
 {
 	enum zone_type z;
 	int bit = (__force int) (flags & GFP_ZONEMASK);
+	VM_BUG_ON((GFP_ZONE_BAD >> bit) & 1);
 
 	z = (GFP_ZONE_TABLE >> (bit * GFP_ZONES_SHIFT)) &
 					 ((1 << GFP_ZONES_SHIFT) - 1);
-	VM_BUG_ON((GFP_ZONE_BAD >> bit) & 1);
+
 	return z;
 }
 
-- 
2.20.1



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

end of thread, other threads:[~2024-09-06  3:50 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-09-05  9:52 [PATCH] mm: move bad zone checking before getting it Wang Yibo
2024-09-05 10:22 ` David Hildenbrand
2024-09-05 10:48   ` [PATCH v2 1/1] mm: move bad zone checking in gfp_zone() Wang Yibo
2024-09-05 13:13     ` David Hildenbrand
2024-09-06  3:35   ` [PATCH] mm: move bad zone checking before getting it Lucien Wang
2024-09-06  3:50   ` Lucien Wang

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