[Suspend2][ 05/13] [Suspend2] LRU paranoia patch.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 <[email protected]>

 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 [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux