Re: [PATCH] Pageset Localization V2

From: Christoph Lameter <christoph_at_lameter.com>
Date: 2005-03-31 13:50:22
Patch to fix the issues mentioned so far. The MAKE_LIST macro would also
not be good to some things that I have planned so lets drop it.

Index: linux-2.6.11/mm/page_alloc.c
===================================================================
--- linux-2.6.11.orig/mm/page_alloc.c	2005-03-30 19:45:23.000000000 -0800
+++ linux-2.6.11/mm/page_alloc.c	2005-03-30 19:46:23.000000000 -0800
@@ -1613,15 +1613,6 @@ void zone_init_free_lists(struct pglist_
 	memmap_init_zone((size), (nid), (zone), (start_pfn))
 #endif

-#define MAKE_LIST(list, nlist)  \
-	do {    \
-		if(list_empty(&list))      \
-			INIT_LIST_HEAD(nlist);          \
-		else {  nlist->next->prev = nlist;      \
-			nlist->prev->next = nlist;      \
-		}                                       \
-	}while(0)
-
 /*
  * Dynamicaly allocate memory for the
  * per cpu pageset array in struct zone.
@@ -1629,6 +1620,7 @@ void zone_init_free_lists(struct pglist_
 static inline int __devinit process_zones(int cpu)
 {
 	struct zone *zone, *dzone;
+	int i;

 	for_each_zone(zone) {
 		struct per_cpu_pageset *npageset = NULL;
@@ -1642,9 +1634,17 @@ static inline int __devinit process_zone

 		if(zone->pageset[cpu]) {
 			memcpy(npageset, zone->pageset[cpu], sizeof(struct per_cpu_pageset));
-			MAKE_LIST(zone->pageset[cpu]->pcp[0].list, (&npageset->pcp[0].list));
-			MAKE_LIST(zone->pageset[cpu]->pcp[1].list, (&npageset->pcp[1].list));
-		}
+
+			/* Fix up the list pointers */
+			for(i = 0; i<2; i++) {
+				if (list_empty(&zone->pageset[cpu]->pcp[i].list))
+					INIT_LIST_HEAD(&npageset->pcp[i].list);
+				else {
+					npageset->pcp[i].list.next->prev = &npageset->pcp[i].list;
+					npageset->pcp[i].list.prev->next = &npageset->pcp[i].list;
+				}
+			}
+ 		}
 		else {
 			struct per_cpu_pages *pcp;
 			unsigned long batch;
@@ -1721,11 +1721,14 @@ struct notifier_block pageset_notifier =

 void __init setup_per_cpu_pageset()
 {
-	/*Iintialize per_cpu_pageset for cpu 0.
-	  A cpuup callback will do this for every cpu
-	  as it comes online
+	int err;
+
+	/* Initialize per_cpu_pageset for cpu 0.
+	 * A cpuup callback will do this for every cpu
+	 * as it comes online
 	 */
-	BUG_ON(process_zones(smp_processor_id()));
+	err = process_zones(smp_processor_id());
+	BUG_ON(err);
 	register_cpu_notifier(&pageset_notifier);
 }

-
To unsubscribe from this list: send the line "unsubscribe linux-ia64" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Received on Wed Mar 30 22:52:26 2005

This archive was generated by hypermail 2.1.8 : 2005-08-02 09:20:37 EST