aboutsummaryrefslogtreecommitdiffstats
path: root/mm/page_alloc.c
diff options
context:
space:
mode:
Diffstat (limited to 'mm/page_alloc.c')
-rw-r--r--mm/page_alloc.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index a790ef4be74e..3674e42e3620 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -155,16 +155,17 @@ static inline void set_pcppage_migratetype(struct page *page, int migratetype)
155 * The following functions are used by the suspend/hibernate code to temporarily 155 * The following functions are used by the suspend/hibernate code to temporarily
156 * change gfp_allowed_mask in order to avoid using I/O during memory allocations 156 * change gfp_allowed_mask in order to avoid using I/O during memory allocations
157 * while devices are suspended. To avoid races with the suspend/hibernate code, 157 * while devices are suspended. To avoid races with the suspend/hibernate code,
158 * they should always be called with pm_mutex held (gfp_allowed_mask also should 158 * they should always be called with system_transition_mutex held
159 * only be modified with pm_mutex held, unless the suspend/hibernate code is 159 * (gfp_allowed_mask also should only be modified with system_transition_mutex
160 * guaranteed not to run in parallel with that modification). 160 * held, unless the suspend/hibernate code is guaranteed not to run in parallel
161 * with that modification).
161 */ 162 */
162 163
163static gfp_t saved_gfp_mask; 164static gfp_t saved_gfp_mask;
164 165
165void pm_restore_gfp_mask(void) 166void pm_restore_gfp_mask(void)
166{ 167{
167 WARN_ON(!mutex_is_locked(&pm_mutex)); 168 WARN_ON(!mutex_is_locked(&system_transition_mutex));
168 if (saved_gfp_mask) { 169 if (saved_gfp_mask) {
169 gfp_allowed_mask = saved_gfp_mask; 170 gfp_allowed_mask = saved_gfp_mask;
170 saved_gfp_mask = 0; 171 saved_gfp_mask = 0;
@@ -173,7 +174,7 @@ void pm_restore_gfp_mask(void)
173 174
174void pm_restrict_gfp_mask(void) 175void pm_restrict_gfp_mask(void)
175{ 176{
176 WARN_ON(!mutex_is_locked(&pm_mutex)); 177 WARN_ON(!mutex_is_locked(&system_transition_mutex));
177 WARN_ON(saved_gfp_mask); 178 WARN_ON(saved_gfp_mask);
178 saved_gfp_mask = gfp_allowed_mask; 179 saved_gfp_mask = gfp_allowed_mask;
179 gfp_allowed_mask &= ~(__GFP_IO | __GFP_FS); 180 gfp_allowed_mask &= ~(__GFP_IO | __GFP_FS);