From: Andrew Morton Date: Sat, 10 Sep 2016 10:34:11 +0000 (+1000) Subject: mm: check that we haven't used more than 32 bits in address_space.flags X-Git-Url: http://drtracing.org/?a=commitdiff_plain;h=f79ed973db90cb9c7384f0cfdcf605b2fc6a7e82;p=deliverable%2Flinux.git mm: check that we haven't used more than 32 bits in address_space.flags After "mm: don't use radix tree writeback tags for pages in swap cache", all the flags are now used up on 32-bit builds. Add a build-time assertion to prevent 64-bit developers from accidentally breaking things. Acked-by: Mel Gorman Cc: "Huang, Ying" Signed-off-by: Andrew Morton --- diff --git a/include/linux/pagemap.h b/include/linux/pagemap.h index 2f5a65ddbebf..08937bd2c11b 100644 --- a/include/linux/pagemap.h +++ b/include/linux/pagemap.h @@ -27,6 +27,8 @@ enum mapping_flags { AS_EXITING = __GFP_BITS_SHIFT + 4, /* final truncate in progress */ /* writeback related tags are not used */ AS_NO_WRITEBACK_TAGS = __GFP_BITS_SHIFT + 5, + + AS_LAST_FLAG, }; static inline void mapping_set_error(struct address_space *mapping, int error) diff --git a/init/main.c b/init/main.c index a8a58e2794a5..47bdcc39266d 100644 --- a/init/main.c +++ b/init/main.c @@ -59,6 +59,7 @@ #include #include #include +#include #include #include #include @@ -463,6 +464,9 @@ void __init __weak thread_stack_cache_init(void) */ static void __init mm_init(void) { + /* Does address_space.flags still fit into a 32-bit ulong? */ + BUILD_BUG_ON(AS_LAST_FLAG > 32); + /* * page_ext requires contiguous pages, * bigger than MAX_ORDER unless SPARSEMEM.