lkml.org 
[lkml]   [2006]   [Jun]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[Suspend2][ 05/13] [Suspend2] LRU paranoia patch.
Date
Modify the Set/Clear LRU flag macros to also BUG_ON() when freezing is
complete, iff CONFIG_PM_DEBUG is enabled. The LRU is supposed to be static
before the atomic copy is made. This just helps verify that this is
happening.

Signed-off-by: Nigel Cunningham <nigel@suspend2.net>

include/linux/page-flags.h | 8 ++++++++
1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h
index d276a4e..1e4d6a5 100644
--- a/include/linux/page-flags.h
+++ b/include/linux/page-flags.h
@@ -7,6 +7,7 @@

#include <linux/percpu.h>
#include <linux/cache.h>
+#include <linux/freezer.h> /* For Suspend2 LRU paranoid Set|ClearPageLRU definitions */
#include <asm/pgtable.h>

/*
@@ -255,9 +256,16 @@ extern void __mod_page_state_offset(unsi
#define TestClearPageDirty(page) test_and_clear_bit(PG_dirty, &(page)->flags)

#define PageLRU(page) test_bit(PG_lru, &(page)->flags)
+
+#ifdef CONFIG_PM_DEBUG
#define SetPageLRU(page) set_bit(PG_lru, &(page)->flags)
#define ClearPageLRU(page) clear_bit(PG_lru, &(page)->flags)
#define __ClearPageLRU(page) __clear_bit(PG_lru, &(page)->flags)
+#else
+#define SetPageLRU(page) do { BUG_ON(test_freezer_state(FREEZING_COMPLETE)); set_bit(PG_lru, &(page)->flags); } while(0)
+#define ClearPageLRU(page) do { BUG_ON(test_freezer_state(FREEZING_COMPLETE)); clear_bit(PG_lru, &(page)->flags); } while(0)
+#define __ClearPageLRU(page) do { BUG_ON(test_freezer_state(FREEZING_COMPLETE)); __clear_bit(PG_lru, &(page)->flags); } while(0)
+#endif

#define PageActive(page) test_bit(PG_active, &(page)->flags)
#define SetPageActive(page) set_bit(PG_active, &(page)->flags)
--
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@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2006-06-27 06:48    [W:0.998 / U:0.036 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site