From: Rusty Russell <rusty@rustcorp.com.au>
To: akpm@osdl.org
Cc: linux-kernel@vger.kernel.org,
Nick Piggin <piggin@cyberone.com.au>,
dipankar@in.ibm.com, vatsa@in.ibm.com
Subject: [PATCH 2/4] 2.6.2-rc2-mm2 CPU Hotplug
Date: Sun, 01 Feb 2004 01:16:38 +1100 [thread overview]
Message-ID: <20040131141938.06CDD2C0DA@lists.samba.org> (raw)
Like CONFIG_PM, CONFIG_HOTPLUG_CPU wants drain_local_pages(), except
we want to drain another (dead) CPU. Trivial change, mainly fixing up
callers.
Name: Change drain_local_pages() To Take a CPU Number
Author: Rusty Russell
Status: Booted on 2.6.2-rc2-bk2
D: Hotplug CPU needs to drain pages on a downed CPU (usually it's the
D: current cpu). Make it an argument, and expose it if CONFIG_HOTPLUG_CPU
D: as well as CONFIG_PM.
diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal .6243-linux-2.6.1-bk4/include/linux/suspend.h .6243-linux-2.6.1-bk4.updated/include/linux/suspend.h
--- .6243-linux-2.6.1-bk4/include/linux/suspend.h 2003-10-23 10:02:54.000000000 +1000
+++ .6243-linux-2.6.1-bk4.updated/include/linux/suspend.h 2004-01-19 15:14:01.000000000 +1100
@@ -43,7 +43,7 @@ struct suspend_header {
extern int shrink_mem(void);
/* mm/page_alloc.c */
-extern void drain_local_pages(void);
+extern void drain_local_pages(unsigned int cpu);
extern unsigned int nr_copy_pages __nosavedata;
extern suspend_pagedir_t *pagedir_nosave __nosavedata;
diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal .6243-linux-2.6.1-bk4/mm/page_alloc.c .6243-linux-2.6.1-bk4.updated/mm/page_alloc.c
--- .6243-linux-2.6.1-bk4/mm/page_alloc.c 2004-01-19 15:13:56.000000000 +1100
+++ .6243-linux-2.6.1-bk4.updated/mm/page_alloc.c 2004-01-19 15:14:01.000000000 +1100
@@ -413,11 +413,13 @@ int is_head_of_free_region(struct page *
spin_unlock_irqrestore(&zone->lock, flags);
return 0;
}
+#endif /* CONFIG_PM */
+#if defined(CONFIG_PM) || defined(CONFIG_HOTPLUG_CPU)
/*
* Spill all of this CPU's per-cpu pages back into the buddy allocator.
*/
-void drain_local_pages(void)
+void drain_local_pages(unsigned int cpu)
{
unsigned long flags;
struct zone *zone;
@@ -427,7 +429,7 @@ void drain_local_pages(void)
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;
@@ -438,7 +440,7 @@ void drain_local_pages(void)
}
local_irq_restore(flags);
}
-#endif /* CONFIG_PM */
+#endif /* CONFIG_PM || CONFIG_HOTPLUG_CPU */
/*
* Free a 0-order page
diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal .6243-linux-2.6.1-bk4/kernel/power/pmdisk.c .6243-linux-2.6.1-bk4.updated/kernel/power/pmdisk.c
--- .6243-linux-2.6.1-bk4/kernel/power/pmdisk.c 2003-10-23 10:02:54.000000000 +1000
+++ .6243-linux-2.6.1-bk4.updated/kernel/power/pmdisk.c 2004-01-19 15:14:01.000000000 +1100
@@ -627,7 +627,7 @@ int pmdisk_suspend(void)
if ((error = read_swapfiles()))
return error;
- drain_local_pages();
+ drain_local_pages(smp_processor_id());
pm_pagedir_nosave = NULL;
pr_debug("pmdisk: Counting pages to copy.\n" );
@@ -658,7 +658,7 @@ int pmdisk_suspend(void)
/* During allocating of suspend pagedir, new cold pages may appear.
* Kill them
*/
- drain_local_pages();
+ drain_local_pages(smp_processor_id());
/* copy */
copy_pages();
diff -urpN --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal .6243-linux-2.6.1-bk4/kernel/power/swsusp.c .6243-linux-2.6.1-bk4.updated/kernel/power/swsusp.c
--- .6243-linux-2.6.1-bk4/kernel/power/swsusp.c 2004-01-10 13:59:39.000000000 +1100
+++ .6243-linux-2.6.1-bk4.updated/kernel/power/swsusp.c 2004-01-19 15:14:01.000000000 +1100
@@ -520,7 +520,7 @@ static int suspend_prepare_image(void)
struct sysinfo i;
unsigned int nr_needed_pages = 0;
- drain_local_pages();
+ drain_local_pages(smp_processor_id());
pagedir_nosave = NULL;
printk( "/critical section: Counting pages to copy" );
@@ -553,7 +553,7 @@ static int suspend_prepare_image(void)
nr_copy_pages_check = nr_copy_pages;
pagedir_order_check = pagedir_order;
- drain_local_pages(); /* During allocating of suspend pagedir, new cold pages may appear. Kill them */
+ drain_local_pages(smp_processor_id()); /* During allocating of suspend pagedir, new cold pages may appear. Kill them */
if (nr_copy_pages != count_and_copy_data_pages(pagedir_nosave)) /* copy */
BUG();
--
Anyone who quotes me in their sig is an idiot. -- Rusty Russell.
reply other threads:[~2004-01-31 14:21 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20040131141938.06CDD2C0DA@lists.samba.org \
--to=rusty@rustcorp.com.au \
--cc=akpm@osdl.org \
--cc=dipankar@in.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=piggin@cyberone.com.au \
--cc=vatsa@in.ibm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome