diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2010-12-06 15:51:14 -0800 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2010-12-06 15:51:14 -0800 |
commit | 7787d2c2f440cc7854bed3d039bf4cc59d9e7897 (patch) | |
tree | d7402ea46b2aa0a4d049e8edc61a302bda4db4d5 /mm | |
parent | 60658f8a293750b59a8a844bf5c387139af9500a (diff) | |
parent | c9e664f1fdf34aa8cede047b206deaa8f1945af0 (diff) | |
download | kernel_samsung_smdk4412-7787d2c2f440cc7854bed3d039bf4cc59d9e7897.zip kernel_samsung_smdk4412-7787d2c2f440cc7854bed3d039bf4cc59d9e7897.tar.gz kernel_samsung_smdk4412-7787d2c2f440cc7854bed3d039bf4cc59d9e7897.tar.bz2 |
Merge branch 'pm-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/suspend-2.6
* 'pm-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/suspend-2.6:
PM / Hibernate: Fix memory corruption related to swap
PM / Hibernate: Use async I/O when reading compressed hibernation image
Diffstat (limited to 'mm')
-rw-r--r-- | mm/page_alloc.c | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/mm/page_alloc.c b/mm/page_alloc.c index e409270..ff7e158 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -104,19 +104,24 @@ gfp_t gfp_allowed_mask __read_mostly = GFP_BOOT_MASK; * only be modified with pm_mutex held, unless the suspend/hibernate code is * guaranteed not to run in parallel with that modification). */ -void set_gfp_allowed_mask(gfp_t mask) + +static gfp_t saved_gfp_mask; + +void pm_restore_gfp_mask(void) { WARN_ON(!mutex_is_locked(&pm_mutex)); - gfp_allowed_mask = mask; + if (saved_gfp_mask) { + gfp_allowed_mask = saved_gfp_mask; + saved_gfp_mask = 0; + } } -gfp_t clear_gfp_allowed_mask(gfp_t mask) +void pm_restrict_gfp_mask(void) { - gfp_t ret = gfp_allowed_mask; - WARN_ON(!mutex_is_locked(&pm_mutex)); - gfp_allowed_mask &= ~mask; - return ret; + WARN_ON(saved_gfp_mask); + saved_gfp_mask = gfp_allowed_mask; + gfp_allowed_mask &= ~GFP_IOFS; } #endif /* CONFIG_PM_SLEEP */ |