aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/linux/gfp.h12
-rw-r--r--include/linux/mmzone.h10
2 files changed, 22 insertions, 0 deletions
diff --git a/include/linux/gfp.h b/include/linux/gfp.h
index f8ffcd401c5f..7e93a9ae7064 100644
--- a/include/linux/gfp.h
+++ b/include/linux/gfp.h
@@ -104,6 +104,18 @@ struct vm_area_struct;
104/* 4GB DMA on some platforms */ 104/* 4GB DMA on some platforms */
105#define GFP_DMA32 __GFP_DMA32 105#define GFP_DMA32 __GFP_DMA32
106 106
107/* Convert GFP flags to their corresponding migrate type */
108static inline int allocflags_to_migratetype(gfp_t gfp_flags)
109{
110 WARN_ON((gfp_flags & GFP_MOVABLE_MASK) == GFP_MOVABLE_MASK);
111
112 if (unlikely(page_group_by_mobility_disabled))
113 return MIGRATE_UNMOVABLE;
114
115 /* Group based on mobility */
116 return (((gfp_flags & __GFP_MOVABLE) != 0) << 1) |
117 ((gfp_flags & __GFP_RECLAIMABLE) != 0);
118}
107 119
108static inline enum zone_type gfp_zone(gfp_t flags) 120static inline enum zone_type gfp_zone(gfp_t flags)
109{ 121{
diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h
index 87a4045580f2..20ea42c45e4a 100644
--- a/include/linux/mmzone.h
+++ b/include/linux/mmzone.h
@@ -43,6 +43,16 @@
43 for (order = 0; order < MAX_ORDER; order++) \ 43 for (order = 0; order < MAX_ORDER; order++) \
44 for (type = 0; type < MIGRATE_TYPES; type++) 44 for (type = 0; type < MIGRATE_TYPES; type++)
45 45
46extern int page_group_by_mobility_disabled;
47
48static inline int get_pageblock_migratetype(struct page *page)
49{
50 if (unlikely(page_group_by_mobility_disabled))
51 return MIGRATE_UNMOVABLE;
52
53 return get_pageblock_flags_group(page, PB_migrate, PB_migrate_end);
54}
55
46struct free_area { 56struct free_area {
47 struct list_head free_list[MIGRATE_TYPES]; 57 struct list_head free_list[MIGRATE_TYPES];
48 unsigned long nr_free; 58 unsigned long nr_free;