[ 23/23] [Suspend2] Don't scan LRU while freezer is on.

From: Nigel Cunningham
Date: Wed Jan 25 2006 - 22:49:16 EST



Stop processes from initiating scanning of the LRU while the freezer is on.
This is primarily for the benefit of Suspend2, which could conceivably
trigger LRU scanning through this path while writing the image, and would
thus generate an inconsistent image and through it all sorts of trouble.

Signed-off-by: Nigel Cunningham <nigel@xxxxxxxxxxxx>

mm/page_alloc.c | 5 +++--
1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index f9151b9..713d773 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -25,6 +25,7 @@
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/suspend.h>
+#include <linux/freezer.h>
#include <linux/pagevec.h>
#include <linux/blkdev.h>
#include <linux/slab.h>
@@ -957,8 +958,8 @@ restart:

/* This allocation should allow future memory freeing. */

- if (((p->flags & PF_MEMALLOC) || unlikely(test_thread_flag(TIF_MEMDIE)))
- && !in_interrupt()) {
+ if ((((p->flags & PF_MEMALLOC) || unlikely(test_thread_flag(TIF_MEMDIE))) &&
+ !in_interrupt()) || (test_freezer_state(FREEZER_ON))) {
if (!(gfp_mask & __GFP_NOMEMALLOC)) {
nofail_alloc:
/* go through the zonelist yet again, ignoring mins */

--
Nigel Cunningham nigel at suspend2 dot net
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/