[PATCH 11/11] Use pageblock flags for anti-fragmentation

From: Mel Gorman
Date: Wed Nov 01 2006 - 06:20:44 EST



This patch alters anti-fragmentation to use the pageblock bits for tracking
the reclaimability of a block of pages.

Signed-off-by: Mel Gorman <mel@xxxxxxxxx>
---

include/linux/pageblock-flags.h | 4 ++++
mm/page_alloc.c | 22 ++++++++++++++++++----
2 files changed, 22 insertions(+), 4 deletions(-)

diff -rup -X /usr/src/patchset-0.6/bin//dontdiff linux-2.6.19-rc4-mm1-102_remove_antifrag_pageflags/include/linux/pageblock-flags.h linux-2.6.19-rc4-mm1-103_antifrag_pageblock_bits/include/linux/pageblock-flags.h
--- linux-2.6.19-rc4-mm1-102_remove_antifrag_pageflags/include/linux/pageblock-flags.h 2006-10-31 17:42:25.000000000 +0000
+++ linux-2.6.19-rc4-mm1-103_antifrag_pageblock_bits/include/linux/pageblock-flags.h 2006-10-31 18:25:54.000000000 +0000
@@ -27,6 +27,10 @@

/* Bit indices that affect a whole block of pages */
enum pageblock_bits {
+#ifdef CONFIG_PAGEALLOC_ANTIFRAG
+ PB_rclmtype,
+ PB_rclmtype_end = (PB_rclmtype + 2) - 1, /* 2 bits for rclm types */
+#endif
NR_PAGEBLOCK_BITS
};

diff -rup -X /usr/src/patchset-0.6/bin//dontdiff linux-2.6.19-rc4-mm1-102_remove_antifrag_pageflags/mm/page_alloc.c linux-2.6.19-rc4-mm1-103_antifrag_pageblock_bits/mm/page_alloc.c
--- linux-2.6.19-rc4-mm1-102_remove_antifrag_pageflags/mm/page_alloc.c 2006-10-31 17:44:48.000000000 +0000
+++ linux-2.6.19-rc4-mm1-103_antifrag_pageblock_bits/mm/page_alloc.c 2006-10-31 18:24:48.000000000 +0000
@@ -140,8 +140,15 @@ static unsigned long __initdata dma_rese
#endif /* CONFIG_ARCH_POPULATES_NODE_MAP */

#ifdef CONFIG_PAGEALLOC_ANTIFRAG
-static inline int get_page_rclmtype(struct page *page)
+static inline int get_pageblock_rclmtype(struct page *page)
{
+ return get_pageblock_flags_group(page, PB_rclmtype, PB_rclmtype_end);
+}
+
+static void set_pageblock_rclmtype(struct page *page, int rclmtype)
+{
+ set_pageblock_flags_group(page, (unsigned long)rclmtype,
+ PB_rclmtype, PB_rclmtype_end);
}

static inline int gfpflags_to_rclmtype(gfp_t gfp_flags)
@@ -153,11 +161,13 @@ static inline int gfpflags_to_rclmtype(g
((gfp_flags & __GFP_KERNRCLM) != 0);
}
#else
-static inline int get_page_rclmtype(struct page *page)
+static inline int get_pageblock_rclmtype(struct page *page)
{
return RCLM_NORCLM;
}

+static inline void set_pageblock_rclmtype(struct page *page, int rclmtype) {}
+
static inline int gfpflags_to_rclmtype(gfp_t gfp_flags)
{
return RCLM_NORCLM;
@@ -433,7 +443,7 @@ static inline void __free_one_page(struc
{
unsigned long page_idx;
int order_size = 1 << order;
- int rclmtype = get_page_rclmtype(page);
+ int rclmtype = get_pageblock_rclmtype(page);

if (unlikely(PageCompound(page)))
destroy_compound_page(page, order);
@@ -713,6 +723,7 @@ int move_freepages_block(struct zone *zo
if (page_zone(page) != page_zone(end_page))
return 0;

+ set_pageblock_rclmtype(start_page, rclmtype);
return move_freepages(zone, start_page, end_page, rclmtype);
}

@@ -825,6 +836,10 @@ static struct page *__rmqueue(struct zon
split_count[rclmtype]++;

expand(zone, page, order, current_order, area, rclmtype);
+
+ if (current_order == MAX_ORDER - 1)
+ set_pageblock_rclmtype(page, rclmtype);
+
goto got_page;
}

@@ -1003,7 +1018,7 @@ void drain_all_local_pages(void) {}
static void fastcall free_hot_cold_page(struct page *page, int cold)
{
struct zone *zone = page_zone(page);
- int pindex = get_page_rclmtype(page);
+ int pindex = get_pageblock_rclmtype(page);
struct per_cpu_pages *pcp;
unsigned long flags;

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