Skip to contentSkip to conversation

New zone ZONE_EASY_RECLAIM[4/5]

Patch:RFC Yasunori Goto 2 participants 3 messages Nov 10, 2005 – Nov 12, 2005

Subsystems (6)
lore
Share & tools
lore
#0 lore raw

__GFP_xxxs are flag for requires of page allocation which zone is prefered. But, it is used as an index number for zonelists[] too. But after my patch, __GFP_xxx might be set at same time. So, last set bit number of __GFP is recognized for zonelists' index by this patch.

---

fs/buffer.c +1 -1
Index: new_zone/fs/buffer.c
===================================================================
@@ -502,7 +502,7 @@ static void free_more_memory(void)
 	yield();
 
 	for_each_pgdat(pgdat) {
-		zones = pgdat->node_zonelists[GFP_NOFS&GFP_ZONEMASK].zones;
+		zones = pgdat->node_zonelists[gfp_zone(GFP_NOFS)].zones;
 		if (*zones)
 			try_to_free_pages(zones, GFP_NOFS);
 	}
include/linux/gfp.h +5 -1
Index: new_zone/include/linux/gfp.h
===================================================================
@@ -65,6 +65,10 @@ struct vm_area_struct;
 
 #define GFP_DMA		__GFP_DMA
 
+static inline unsigned int gfp_zone(unsigned int mask)
+{
+	return fls(mask & GFP_ZONEMASK);
+}
 
 /*
  * There is only one page-allocator function, and two main namespaces to
@@ -95,7 +99,7 @@ static inline struct page *alloc_pages_n
 		return NULL;
 
 	return __alloc_pages(gfp_mask, order,
-		NODE_DATA(nid)->node_zonelists + (gfp_mask & GFP_ZONEMASK));
+		NODE_DATA(nid)->node_zonelists + gfp_zone(gfp_mask));
 }
 
 #ifdef CONFIG_NUMA
include/linux/mmzone.h +1 -0
Index: new_zone/include/linux/mmzone.h
===================================================================
@@ -92,6 +92,7 @@ struct per_cpu_pageset {
  * combinations of zone modifiers in "zone modifier space".
  */
 #define GFP_ZONEMASK	0x07
+
 /*
  * As an optimisation any zone modifier bits which are only valid when
  * no other zone modifier bits are set (loners) should be placed in
mm/mempolicy.c +2 -2
Index: new_zone/mm/mempolicy.c
===================================================================
@@ -712,7 +712,7 @@ static struct zonelist *zonelist_policy(
 		nd = 0;
 		BUG();
 	}
-	return NODE_DATA(nd)->node_zonelists + (gfp & GFP_ZONEMASK);
+	return NODE_DATA(nd)->node_zonelists + gfp_zone(gfp);
 }
 
 /* Do dynamic interleaving for a process */
@@ -757,7 +757,7 @@ static struct page *alloc_page_interleav
 	struct page *page;
 
 	BUG_ON(!node_online(nid));
-	zl = NODE_DATA(nid)->node_zonelists + (gfp & GFP_ZONEMASK);
+	zl = NODE_DATA(nid)->node_zonelists + gfp_zone(gfp);
 	page = __alloc_pages(gfp, order, zl);
 	if (page && page_zone(page) == zl->zones[0]) {
 		zone_pcp(zl->zones[0],get_cpu())->interleave_hit++;
mm/page_alloc.c +2 -2
Index: new_zone/mm/page_alloc.c
===================================================================
@@ -1089,7 +1089,7 @@ static unsigned int nr_free_zone_pages(i
  */
 unsigned int nr_free_buffer_pages(void)
 {
-	return nr_free_zone_pages(GFP_USER & GFP_ZONEMASK);
+	return nr_free_zone_pages(gfp_zone(GFP_USER));
 }
 
 /*
@@ -1097,7 +1097,7 @@ unsigned int nr_free_buffer_pages(void)
  */
 unsigned int nr_free_pagecache_pages(void)
 {
-	return nr_free_zone_pages(GFP_HIGHUSER & GFP_ZONEMASK);
+	return nr_free_zone_pages(gfp_zone(GFP_HIGHUSER));
 }
 
 #ifdef CONFIG_HIGHMEM
Signature · 8 lines
Yasunori Goto 


--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected].  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
#1 lore raw
Quoted 12 lines · Yasunori Goto

===================================================================

include/linux/mmzone.h +1 -0
@@ -92,6 +92,7 @@ struct per_cpu_pageset {
  * combinations of zone modifiers in "zone modifier space".
  */
 #define GFP_ZONEMASK	0x07
+
 /*
  * As an optimisation any zone modifier bits which are only valid when
  * no other zone modifier bits are set (loners) should be placed in
Quoted 2 lines

Index: new_zone/mm/mempolicy.c
===================================================================

It looks like the only thing this patch changes in this file is whitespace

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

#2 lore raw
Quoted 17 lines
Quoted 12 lines · Yasunori Goto

===================================================================

include/linux/mmzone.h +1 -0
@@ -92,6 +92,7 @@ struct per_cpu_pageset {
  * combinations of zone modifiers in "zone modifier space".
  */
 #define GFP_ZONEMASK	0x07
+
 /*
  * As an optimisation any zone modifier bits which are only valid when
  * no other zone modifier bits are set (loners) should be placed in
Quoted 2 lines

Index: new_zone/mm/mempolicy.c
===================================================================

It looks like the only thing this patch changes in this file is whitespace

Oops. I made a mistake. Thanks. :-)

Signature · 8 lines
Yasunori Goto 


--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected].  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>