mm: check that we haven't used more than 32 bits in address_space.flags
authorAndrew Morton <akpm@linux-foundation.org>
Sat, 10 Sep 2016 10:34:11 +0000 (20:34 +1000)
committerStephen Rothwell <sfr@canb.auug.org.au>
Sat, 10 Sep 2016 10:34:11 +0000 (20:34 +1000)
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 <mgorman@techsingularity.net>
Cc: "Huang, Ying" <ying.huang@intel.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
include/linux/pagemap.h
init/main.c

index 2f5a65ddbebfeba28e0768d82427621db1a58bd9..08937bd2c11bba0a3da8b852e326e5a7133bda48 100644 (file)
@@ -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)
index a8a58e2794a50469d465fad1a6939a4b68ec1114..47bdcc39266dcf71a929de5f84049d2e80d05720 100644 (file)
@@ -59,6 +59,7 @@
 #include <linux/pid_namespace.h>
 #include <linux/device.h>
 #include <linux/kthread.h>
+#include <linux/pagemap.h>
 #include <linux/sched.h>
 #include <linux/signal.h>
 #include <linux/idr.h>
@@ -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.
This page took 0.037413 seconds and 5 git commands to generate.