[RFC] [PATCH 2/5] Dynamically allocated pageflags - PageMappedToDisk conversion.

From: Nigel Cunningham
Date: Mon Jul 23 2007 - 09:20:01 EST


Switch the "MappedToDisk" pageflag to using dynpageflags.

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


include/linux/page-flags.h | 9 +++++----
mm/dyn_pageflags.c | 2 ++
mm/page_alloc.c | 3 ++-
3 files changed, 9 insertions(+), 5 deletions(-)
diff -ruNp 920-mapped-to-disk-pageflag.patch-old/include/linux/page-flags.h 920-mapped-to-disk-pageflag.patch-new/include/linux/page-flags.h
--- 920-mapped-to-disk-pageflag.patch-old/include/linux/page-flags.h 2007-07-11 22:19:39.000000000 +1000
+++ 920-mapped-to-disk-pageflag.patch-new/include/linux/page-flags.h 2007-07-23 22:13:01.000000000 +1000
@@ -7,6 +7,7 @@

#include <linux/types.h>
#include <linux/mm_types.h>
+#include <linux/dyn_pageflags.h>

/*
* Various page->flags bits:
@@ -86,7 +87,6 @@
#define PG_compound 14 /* Part of a compound page */
#define PG_swapcache 15 /* Swap page: swp_entry_t in private */

-#define PG_mappedtodisk 16 /* Has blocks allocated on-disk */
#define PG_reclaim 17 /* To be reclaimed asap */
#define PG_buddy 19 /* Page is free, on buddy lists */

@@ -217,9 +217,10 @@ static inline void SetPageUptodate(struc
#define __SetPageBuddy(page) __set_bit(PG_buddy, &(page)->flags)
#define __ClearPageBuddy(page) __clear_bit(PG_buddy, &(page)->flags)

-#define PageMappedToDisk(page) test_bit(PG_mappedtodisk, &(page)->flags)
-#define SetPageMappedToDisk(page) set_bit(PG_mappedtodisk, &(page)->flags)
-#define ClearPageMappedToDisk(page) clear_bit(PG_mappedtodisk, &(page)->flags)
+extern struct dyn_pageflags dyn_MappedToDisk_map;
+#define PageMappedToDisk(page) test_dynpageflag(&dyn_MappedToDisk_map, page)
+#define SetPageMappedToDisk(page) set_dynpageflag(&dyn_MappedToDisk_map, page)
+#define ClearPageMappedToDisk(page) clear_dynpageflag(&dyn_MappedToDisk_map, page)

#define PageReclaim(page) test_bit(PG_reclaim, &(page)->flags)
#define SetPageReclaim(page) set_bit(PG_reclaim, &(page)->flags)
diff -ruNp 920-mapped-to-disk-pageflag.patch-old/mm/dyn_pageflags.c 920-mapped-to-disk-pageflag.patch-new/mm/dyn_pageflags.c
--- 920-mapped-to-disk-pageflag.patch-old/mm/dyn_pageflags.c 2007-07-23 22:12:58.000000000 +1000
+++ 920-mapped-to-disk-pageflag.patch-new/mm/dyn_pageflags.c 2007-07-23 22:13:01.000000000 +1000
@@ -113,6 +113,8 @@ static int dyn_pageflags_debug = 0;
for_each_online_pgdat(pgdat) \
for (zone_nr = 0; zone_nr < MAX_NR_ZONES; zone_nr++)

+DECLARE_DYN_PAGEFLAGS(dyn_MappedToDisk_map);
+
/**
* dump_pagemap: Display the contents of a bitmap for debugging purposes.
*
diff -ruNp 920-mapped-to-disk-pageflag.patch-old/mm/page_alloc.c 920-mapped-to-disk-pageflag.patch-new/mm/page_alloc.c
--- 920-mapped-to-disk-pageflag.patch-old/mm/page_alloc.c 2007-07-11 22:19:42.000000000 +1000
+++ 920-mapped-to-disk-pageflag.patch-new/mm/page_alloc.c 2007-07-23 22:13:01.000000000 +1000
@@ -610,7 +610,8 @@ static int prep_new_page(struct page *pa

page->flags &= ~(1 << PG_uptodate | 1 << PG_error |
1 << PG_referenced | 1 << PG_arch_1 |
- 1 << PG_owner_priv_1 | 1 << PG_mappedtodisk);
+ 1 << PG_owner_priv_1);
+ ClearPageMappedToDisk(page);
set_page_private(page, 0);
set_page_refcounted(page);

-
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/