aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeter Collingbourne <pcc@google.com>2022-07-26 16:02:41 -0700
committerAndrew Morton <akpm@linux-foundation.org>2022-09-11 20:25:53 -0700
commit4d86d4f7227c6f2acfbbbe0623d49865aa71b756 (patch)
treee6e27cdb7ef6fc96c596e5ad9e7a11e7cd2af44c
parentmm/gup.c: simplify and fix check_and_migrate_movable_pages() return codes (diff)
downloadlinux-dev-4d86d4f7227c6f2acfbbbe0623d49865aa71b756.tar.xz
linux-dev-4d86d4f7227c6f2acfbbbe0623d49865aa71b756.zip
mm: add more BUILD_BUG_ONs to gfp_migratetype()
gfp_migratetype() also expects GFP_RECLAIMABLE and GFP_MOVABLE|GFP_RECLAIMABLE to be shiftable into MIGRATE_* enum values, so add some more BUILD_BUG_ONs to reflect this assumption. Link: https://linux-review.googlesource.com/id/Iae64e2182f75c3aca776a486b71a72571d66d83e Link: https://lkml.kernel.org/r/20220726230241.3770532-1-pcc@google.com Signed-off-by: Peter Collingbourne <pcc@google.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
-rw-r--r--include/linux/gfp.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/include/linux/gfp.h b/include/linux/gfp.h
index f314be58fa77..ea6cb9399152 100644
--- a/include/linux/gfp.h
+++ b/include/linux/gfp.h
@@ -18,6 +18,9 @@ static inline int gfp_migratetype(const gfp_t gfp_flags)
VM_WARN_ON((gfp_flags & GFP_MOVABLE_MASK) == GFP_MOVABLE_MASK);
BUILD_BUG_ON((1UL << GFP_MOVABLE_SHIFT) != ___GFP_MOVABLE);
BUILD_BUG_ON((___GFP_MOVABLE >> GFP_MOVABLE_SHIFT) != MIGRATE_MOVABLE);
+ BUILD_BUG_ON((___GFP_RECLAIMABLE >> GFP_MOVABLE_SHIFT) != MIGRATE_RECLAIMABLE);
+ BUILD_BUG_ON(((___GFP_MOVABLE | ___GFP_RECLAIMABLE) >>
+ GFP_MOVABLE_SHIFT) != MIGRATE_HIGHATOMIC);
if (unlikely(page_group_by_mobility_disabled))
return MIGRATE_UNMOVABLE;