diff options
Diffstat (limited to 'mm/page_alloc.c')
-rw-r--r-- | mm/page_alloc.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 0734bedabd9c..298f307c63a1 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c | |||
@@ -76,6 +76,31 @@ unsigned long totalreserve_pages __read_mostly; | |||
76 | int percpu_pagelist_fraction; | 76 | int percpu_pagelist_fraction; |
77 | gfp_t gfp_allowed_mask __read_mostly = GFP_BOOT_MASK; | 77 | gfp_t gfp_allowed_mask __read_mostly = GFP_BOOT_MASK; |
78 | 78 | ||
79 | #ifdef CONFIG_PM_SLEEP | ||
80 | /* | ||
81 | * The following functions are used by the suspend/hibernate code to temporarily | ||
82 | * change gfp_allowed_mask in order to avoid using I/O during memory allocations | ||
83 | * while devices are suspended. To avoid races with the suspend/hibernate code, | ||
84 | * they should always be called with pm_mutex held (gfp_allowed_mask also should | ||
85 | * only be modified with pm_mutex held, unless the suspend/hibernate code is | ||
86 | * guaranteed not to run in parallel with that modification). | ||
87 | */ | ||
88 | void set_gfp_allowed_mask(gfp_t mask) | ||
89 | { | ||
90 | WARN_ON(!mutex_is_locked(&pm_mutex)); | ||
91 | gfp_allowed_mask = mask; | ||
92 | } | ||
93 | |||
94 | gfp_t clear_gfp_allowed_mask(gfp_t mask) | ||
95 | { | ||
96 | gfp_t ret = gfp_allowed_mask; | ||
97 | |||
98 | WARN_ON(!mutex_is_locked(&pm_mutex)); | ||
99 | gfp_allowed_mask &= ~mask; | ||
100 | return ret; | ||
101 | } | ||
102 | #endif /* CONFIG_PM_SLEEP */ | ||
103 | |||
79 | #ifdef CONFIG_HUGETLB_PAGE_SIZE_VARIABLE | 104 | #ifdef CONFIG_HUGETLB_PAGE_SIZE_VARIABLE |
80 | int pageblock_order __read_mostly; | 105 | int pageblock_order __read_mostly; |
81 | #endif | 106 | #endif |