mm: Add is_migrate_cma_page
authorLaura Abbott <labbott@redhat.com>
Tue, 19 Jul 2016 22:00:04 +0000 (15:00 -0700)
committerKees Cook <keescook@chromium.org>
Tue, 26 Jul 2016 21:41:46 +0000 (14:41 -0700)
Code such as hardened user copy[1] needs a way to tell if a
page is CMA or not. Add is_migrate_cma_page in a similar way
to is_migrate_isolate_page.

[1]http://article.gmane.org/gmane.linux.kernel.mm/155238

Signed-off-by: Laura Abbott <labbott@redhat.com>
Signed-off-by: Kees Cook <keescook@chromium.org>
include/linux/mmzone.h

index 02069c23486de013baa2d1c8f32c305a24224d7d..c8478b29f0707426a637fdfda76adb689235e929 100644 (file)
@@ -68,8 +68,10 @@ extern char * const migratetype_names[MIGRATE_TYPES];
 
 #ifdef CONFIG_CMA
 #  define is_migrate_cma(migratetype) unlikely((migratetype) == MIGRATE_CMA)
+#  define is_migrate_cma_page(_page) (get_pageblock_migratetype(_page) == MIGRATE_CMA)
 #else
 #  define is_migrate_cma(migratetype) false
+#  define is_migrate_cma_page(_page) false
 #endif
 
 #define for_each_migratetype_order(order, type) \