mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH][2.6-mm] split drain_local_pages
@ 2004-02-16 22:40 Zwane Mwaikambo
  2004-02-16 22:44 ` Pavel Machek
  2004-02-17  7:29 ` Rusty Russell
  0 siblings, 2 replies; 7+ messages in thread
From: Zwane Mwaikambo @ 2004-02-16 22:40 UTC (permalink / raw)
  To: Linux Kernel; +Cc: Andrew Morton, lhcs-devel, Pavel Machek, Rusty Russell

CPU hotplug core needs to pass a cpu parameter to drain_local_pages, it's
safe to call __drain_local_pages if the cpu being drained is offline. The
semantics for drain_local_pages do not change.

Index: linux-2.6.3-rc3-mm1/mm/page_alloc.c
===================================================================
RCS file: /home/cvsroot/linux-2.6.3-rc3-mm1/mm/page_alloc.c,v
retrieving revision 1.1.1.1
diff -u -p -B -r1.1.1.1 page_alloc.c
--- linux-2.6.3-rc3-mm1/mm/page_alloc.c	16 Feb 2004 20:42:50 -0000	1.1.1.1
+++ linux-2.6.3-rc3-mm1/mm/page_alloc.c	16 Feb 2004 21:58:19 -0000
@@ -414,19 +414,19 @@ int is_head_of_free_region(struct page *
 }

 /*
- * Spill all of this CPU's per-cpu pages back into the buddy allocator.
+ * drain_local_pages helper, this is only safe to use when the cpu
+ * being drained isn't currently online.
  */
-void drain_local_pages(void)
+
+void __drain_local_pages(int cpu)
 {
-	unsigned long flags;
 	struct zone *zone;
 	int i;
-
-	local_irq_save(flags);
+
 	for_each_zone(zone) {
 		struct per_cpu_pageset *pset;

-		pset = &zone->pageset[smp_processor_id()];
+		pset = &zone->pageset[cpu];
 		for (i = 0; i < ARRAY_SIZE(pset->pcp); i++) {
 			struct per_cpu_pages *pcp;

@@ -435,7 +435,19 @@ void drain_local_pages(void)
 						&pcp->list, 0);
 		}
 	}
-	local_irq_restore(flags);
+}
+
+/*
+ * Spill all of this CPU's per-cpu pages back into the buddy allocator.
+ */
+
+void drain_local_pages(void)
+{
+	unsigned long flags;
+
+	local_irq_save(flags);
+	__drain_local_pages(smp_processor_id());
+	local_irq_restore(flags);
 }
 #endif /* CONFIG_PM */

@@ -1574,7 +1586,7 @@ static int page_alloc_cpu_notify(struct
 		count = &per_cpu(nr_pagecache_local, cpu);
 		atomic_add(*count, &nr_pagecache);
 		*count = 0;
-		drain_local_pages(cpu);
+		__drain_local_pages(cpu);
 	}
 	return NOTIFY_OK;
 }

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2004-02-17  9:38 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-02-16 22:40 [PATCH][2.6-mm] split drain_local_pages Zwane Mwaikambo
2004-02-16 22:44 ` Pavel Machek
2004-02-16 22:53   ` Zwane Mwaikambo
2004-02-16 23:06   ` Andrew Morton
2004-02-17  5:07     ` Rusty Russell
2004-02-17  7:29 ` Rusty Russell
2004-02-17  9:37   ` Zwane Mwaikambo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®