

At Tue, 30 Nov 2004 11:55:00 -0800,
Dave Hansen wrote:
> 
> Could you please repost this with the cpu macro fix, and a signed-off-by
> line?

Here it is.  This applies on top of linux-2.6.10-mm1-mhp-test7.

Signed-off-by: IWAMOTO Toshihiro <iwamoto@valinux.co.jp>
Signed-off-by: Dave Hansen <haveblue@us.ibm.com>
---

 memhotplug-dave/mm/page_alloc.c |   20 ++++++++++++++++++++
 1 files changed, 20 insertions(+)

diff -puN mm/page_alloc.c~K8-call_lru_add_drain_when_removing_memory mm/page_alloc.c
--- memhotplug/mm/page_alloc.c~K8-call_lru_add_drain_when_removing_memory	2005-04-13 14:21:07.000000000 -0700
+++ memhotplug-dave/mm/page_alloc.c	2005-04-13 14:21:07.000000000 -0700
@@ -375,6 +375,25 @@ static inline void extract_pages(struct 
 }
 
 #ifdef CONFIG_MEMORY_REMOVE
+
+DEFINE_PER_CPU(struct work_struct, lru_drain_wq);
+static void lru_drain_schedule(void *p)
+{
+	int cpu = get_cpu();
+
+	schedule_work(&per_cpu(lru_drain_wq, cpu));
+	put_cpu();
+}
+static int __init lru_drain_wq_init(void)
+{
+	int i;
+
+	for_each_cpu(i)
+		INIT_WORK(&per_cpu(lru_drain_wq, i), (void (*)(void *))lru_add_drain, NULL);
+	return 0;
+}
+module_init(lru_drain_wq_init);
+
 /*
  * Called when trying to allocate or free a page that has been marked for
  * removal.
@@ -748,6 +767,7 @@ int capture_page_range(unsigned long sta
 
 	page = pfn_to_page(start_pfn);
 	remove_page_freearea(page, order);
+	on_each_cpu(lru_drain_schedule, NULL, 1, 1);
 	force_captured_to_inactive_list(page);
 	/*
 	 * storing the last result (fp) keeps up from having
_
