linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
To: Christoph Lameter <cl@linux-foundation.org>
Cc: kosaki.motohiro@jp.fujitsu.com, akpm@linux-foundation.org,
	Pekka Enberg <penberg@cs.helsinki.fi>,
	Christoph Lameter <clameter@sgi.com>,
	linux-kernel@vger.kernel.org, linux-mm@kvack.org, travis@sgi.com,
	Stephen Rothwell <sfr@canb.auug.org.au>,
	Vegard Nossum <vegard.nossum@gmail.com>
Subject: Re: [patch 7/7] cpu alloc: page allocator conversion
Date: Tue, 11 Nov 2008 15:10:08 +0900 (JST)	[thread overview]
Message-ID: <20081111150654.617F.KOSAKI.MOTOHIRO@jp.fujitsu.com> (raw)
In-Reply-To: <Pine.LNX.4.64.0811071242560.5387@quilx.com>

> On Fri, 7 Nov 2008, KOSAKI Motohiro wrote:
> 
> > However, if cpu-unplug happend, any pages in pcp should flush to buddy (I think).
> 
> Right. They are not?
> 

Doh, I really silly.
yes, pcp dropping is processed by another function.
I missed it.

very sorry.


In addition, I think cleanup is better.
I made the patch.



===========================================================
Now, page_alloc_init() doesn't have page allocator stuff and there are the cpu unplug processing for pcp
in two place (pageset_cpuup_callback() and page_alloc_init()).
it isn't reasonable nor easy readable.

cleanup here.


Signed-off-by: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
---
 init/main.c     |    1 
 mm/page_alloc.c |   60 +++++++++++++++++++++++++-------------------------------
 2 files changed, 27 insertions(+), 34 deletions(-)

Index: b/mm/page_alloc.c
===================================================================
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -2765,6 +2765,28 @@ static void __cpuinit process_zones(int 
 }
 
 #ifdef CONFIG_SMP
+static void drain_pages_and_fold_stats(int cpu)
+{
+	drain_pages(cpu);
+
+	/*
+	 * Spill the event counters of the dead processor
+	 * into the current processors event counters.
+	 * This artificially elevates the count of the current
+	 * processor.
+	 */
+	vm_events_fold_cpu(cpu);
+
+	/*
+	 * Zero the differential counters of the dead processor
+	 * so that the vm statistics are consistent.
+	 *
+	 * This is only okay since the processor is dead and cannot
+	 * race with what we are doing.
+	 */
+	refresh_cpu_vm_stats(cpu);
+}
+
 static int __cpuinit pageset_cpuup_callback(struct notifier_block *nfb,
 		unsigned long action,
 		void *hcpu)
@@ -2777,6 +2799,11 @@ static int __cpuinit pageset_cpuup_callb
 	case CPU_UP_PREPARE_FROZEN:
 		process_zones(cpu);
 		break;
+	case CPU_DEAD:
+	case CPU_DEAD_FROZEN:
+		drain_pages_and_fold_stats(cpu);
+		break;
+
 	default:
 		break;
 	}
@@ -4092,39 +4119,6 @@ void __init free_area_init(unsigned long
 			__pa(PAGE_OFFSET) >> PAGE_SHIFT, NULL);
 }
 
-static int page_alloc_cpu_notify(struct notifier_block *self,
-				 unsigned long action, void *hcpu)
-{
-	int cpu = (unsigned long)hcpu;
-
-	if (action == CPU_DEAD || action == CPU_DEAD_FROZEN) {
-		drain_pages(cpu);
-
-		/*
-		 * Spill the event counters of the dead processor
-		 * into the current processors event counters.
-		 * This artificially elevates the count of the current
-		 * processor.
-		 */
-		vm_events_fold_cpu(cpu);
-
-		/*
-		 * Zero the differential counters of the dead processor
-		 * so that the vm statistics are consistent.
-		 *
-		 * This is only okay since the processor is dead and cannot
-		 * race with what we are doing.
-		 */
-		refresh_cpu_vm_stats(cpu);
-	}
-	return NOTIFY_OK;
-}
-
-void __init page_alloc_init(void)
-{
-	hotcpu_notifier(page_alloc_cpu_notify, 0);
-}
-
 /*
  * calculate_totalreserve_pages - called when sysctl_lower_zone_reserve_ratio
  *	or min_free_kbytes changes.
Index: b/init/main.c
===================================================================
--- a/init/main.c
+++ b/init/main.c
@@ -619,7 +619,6 @@ asmlinkage void __init start_kernel(void
 	 */
 	preempt_disable();
 	build_all_zonelists();
-	page_alloc_init();
 	printk(KERN_NOTICE "Kernel command line: %s\n", boot_command_line);
 	parse_early_param();
 	parse_args("Booting kernel", static_command_line, __start___param,


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

  reply	other threads:[~2008-11-11  6:10 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-11-05 23:16 [patch 0/7] cpu alloc stage 2 Christoph Lameter
2008-11-05 23:16 ` [patch 1/7] Increase default reserve percpu area Christoph Lameter
2008-11-05 23:16 ` [patch 2/7] cpu alloc: Use in slub Christoph Lameter
2008-11-05 23:16 ` [patch 3/7] cpu alloc: Remove slub fields Christoph Lameter
2008-11-05 23:16 ` [patch 4/7] cpu ops: Core piece for generic atomic per cpu operations Christoph Lameter
2008-11-06  3:58   ` Dave Chinner
2008-11-06 15:05     ` Christoph Lameter
2008-11-05 23:16 ` [patch 5/7] x86_64: Support for cpu ops Christoph Lameter
2008-11-06  7:12   ` Ingo Molnar
2008-11-06 15:08     ` Christoph Lameter
2008-11-06 15:15       ` Ingo Molnar
2008-11-06 15:44         ` Mike Travis
2008-11-06 16:27           ` Christoph Lameter
2008-11-06 16:11         ` Christoph Lameter
2008-11-05 23:16 ` [patch 6/7] VM statistics: Use CPU ops Christoph Lameter
2008-11-05 23:16 ` [patch 7/7] cpu alloc: page allocator conversion Christoph Lameter
2008-11-06  2:52   ` KOSAKI Motohiro
2008-11-06 15:04     ` Christoph Lameter
2008-11-07  0:37       ` KOSAKI Motohiro
2008-11-07 18:43         ` Christoph Lameter
2008-11-11  6:10           ` KOSAKI Motohiro [this message]
2008-11-12  2:02             ` Christoph Lameter
2008-11-11 23:56 ` [patch 0/7] cpu alloc stage 2 Andrew Morton
2008-11-12  0:28   ` Christoph Lameter
2008-11-12  6:57 ` Stephen Rothwell
2008-11-12 20:07   ` Christoph Lameter
2008-11-12 23:35     ` Stephen Rothwell
2008-11-13 14:28       ` Christoph Lameter
2008-11-13 21:09         ` Christoph Lameter

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=20081111150654.617F.KOSAKI.MOTOHIRO@jp.fujitsu.com \
    --to=kosaki.motohiro@jp.fujitsu.com \
    --cc=akpm@linux-foundation.org \
    --cc=cl@linux-foundation.org \
    --cc=clameter@sgi.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=penberg@cs.helsinki.fi \
    --cc=sfr@canb.auug.org.au \
    --cc=travis@sgi.com \
    --cc=vegard.nossum@gmail.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