From: Nigel Cunningham <nigel@suspend2.net>
To: linux-kernel@vger.kernel.org
Subject: [Suspend2][ 07/13] [Suspend2] Page_alloc paranoia.
Date: Tue, 27 Jun 2006 14:42:50 +1000 [thread overview]
Message-ID: <20060627044248.15066.52507.stgit@nigel.suspend2.net> (raw)
In-Reply-To: <20060627044226.15066.7403.stgit@nigel.suspend2.net>
Add paranoia to the page_alloc code to ensure we don't start page reclaim
during suspending.
Signed-off-by: Nigel Cunningham <nigel@suspend2.net>
mm/page_alloc.c | 18 +++++++++++++-----
1 files changed, 13 insertions(+), 5 deletions(-)
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 253a450..838ae19 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>
@@ -37,6 +38,7 @@
#include <linux/nodemask.h>
#include <linux/vmalloc.h>
#include <linux/mempolicy.h>
+#include "../kernel/power/pageflags.h"
#include <asm/tlbflush.h>
#include <asm/div64.h>
@@ -905,7 +907,8 @@ get_page_from_freelist(gfp_t gfp_mask, u
else
mark = (*z)->pages_high;
if (!zone_watermark_ok(*z, order, mark,
- classzone_idx, alloc_flags))
+ classzone_idx, alloc_flags) &&
+ likely(!test_freezer_state(FREEZER_ON)))
if (!zone_reclaim_mode ||
!zone_reclaim(*z, gfp_mask, order))
continue;
@@ -950,10 +953,12 @@ restart:
if (page)
goto got_pg;
- do {
- if (cpuset_zone_allowed(*z, gfp_mask|__GFP_HARDWALL))
- wakeup_kswapd(*z, order);
- } while (*(++z));
+ if (likely(!test_freezer_state(FREEZER_ON))) {
+ do {
+ if (cpuset_zone_allowed(*z, gfp_mask|__GFP_HARDWALL))
+ wakeup_kswapd(*z, order);
+ } while (*(++z));
+ }
/*
* OK, we're below the kswapd watermark and have kicked background
@@ -997,6 +1002,7 @@ nofail_alloc:
if (page)
goto got_pg;
if (gfp_mask & __GFP_NOFAIL) {
+ BUG_ON(unlikely(test_freezer_state(FREEZING_COMPLETE)));
blk_congestion_wait(WRITE, HZ/50);
goto nofail_alloc;
}
@@ -1009,6 +1015,8 @@ nofail_alloc:
goto nopage;
rebalance:
+ BUG_ON(unlikely(test_freezer_state(FREEZER_ON)));
+
cond_resched();
/* We now go into synchronous reclaim */
--
Nigel Cunningham nigel at suspend2 dot net
next prev parent reply other threads:[~2006-06-27 4:43 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-06-27 4:42 [Suspend2][ 00/13] Miscellaneous patches Nigel Cunningham
2006-06-27 4:42 ` [Suspend2][ 01/13] [Suspend2] Suspend2 version header Nigel Cunningham
2006-06-27 4:42 ` [Suspend2][ 02/13] [Suspend2] Boot time hooks Nigel Cunningham
2006-06-27 4:42 ` [Suspend2][ 03/13] [Suspend2] Add netlink socket numbers Nigel Cunningham
2006-06-27 4:42 ` [Suspend2][ 04/13] [Suspend2] Follow page routine Nigel Cunningham
2006-06-27 4:42 ` [Suspend2][ 05/13] [Suspend2] LRU paranoia patch Nigel Cunningham
2006-06-27 4:42 ` [Suspend2][ 06/13] [Suspend2] Remove __nosave declarations in power.h Nigel Cunningham
2006-06-27 4:42 ` Nigel Cunningham [this message]
2006-06-27 6:11 ` [Suspend2][ 07/13] [Suspend2] Page_alloc paranoia Nick Piggin
2006-06-27 6:34 ` Nigel Cunningham
2006-06-29 16:22 ` Nick Piggin
2006-06-29 22:15 ` Nigel Cunningham
2006-07-04 10:54 ` Nigel Cunningham
2006-07-04 16:53 ` Nick Piggin
2006-06-27 6:33 ` Paul Jackson
2006-06-27 7:01 ` Nigel Cunningham
2006-06-27 4:42 ` [Suspend2][ 08/13] [Suspend2] Powerpc support (needed?) Nigel Cunningham
2006-06-27 4:42 ` [Suspend2][ 09/13] [Suspend2] Reset kswapd_max_order after resume Nigel Cunningham
2006-06-27 4:43 ` [Suspend2][ 10/13] [Suspend2] Replace swsusp reboot hook Nigel Cunningham
2006-06-27 4:43 ` [Suspend2][ 11/13] [Suspend2] snprintf_used function Nigel Cunningham
2006-06-27 4:43 ` [Suspend2][ 12/13] [Suspend2] Suspend2 common header Nigel Cunningham
2006-06-27 4:43 ` [Suspend2][ 13/13] [Suspend2] Suspend2 include file Nigel Cunningham
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20060627044248.15066.52507.stgit@nigel.suspend2.net \
--to=nigel@suspend2.net \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome