public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Ravikiran G Thirumalai <kiran@scalex86.org>
To: Andrew Morton <akpm@osdl.org>
Cc: linux-kernel@vger.kernel.org,
	Alok Kataria <alok.kataria@calsoftinc.com>,
	"Shai Fultheim (Shai@scalex86.org)" <shai@scalex86.org>,
	"Benzi Galili (Benzi@ScaleMP.com)" <benzi@scalemp.com>
Subject: [patch] mm: Fix incorrect mempolicy for idle threads
Date: Mon, 2 Oct 2006 19:49:14 -0700	[thread overview]
Message-ID: <20061003024914.GA4071@localhost.localdomain> (raw)

The kernel boots up on the BP with an initial memory policy of
MPOL_INTERLEAVE (start_kernel() -> numa_policy_init()).  This is
done to avoid all boot data structure allocations to be off the boot
node. Current mainline resets the memory policy to MPOL_DEFAULT at init(), 
just before calling userspace init.  But, this is too late and leaves 
the kernel idle thread with MPOL_INTERLEAVE, causing later allocations 
off interrupt/BH context to use MPOL_INTERLEAVE, rather than MPOL_DEFAULT 
(if the interrupt occurs on an idle cpu).  This can be fixed by changing 
the mempolicy to MPOL_DEFAULT just before the 'init' kernel thread is 
spawned, OR just before smp_init() (smp_init would spawn idle threads).  
The following patch uses the latter approach and moves numa_default_policy() 
to just  before smp_init().

Signed-off-by: Alok N Kataria <alok.kataria@calsoftinc.com>
Signed-off-by: Ravikiran Thirumalai <kiran@scalex86.org>
Signed-off-by: Shai Fultheim <shai@scalex86.org>

Index: linux-2.6.18/init/main.c
===================================================================
--- linux-2.6.18.orig/init/main.c	2006-09-19 20:42:06.000000000 -0700
+++ linux-2.6.18/init/main.c	2006-09-28 15:13:01.000000000 -0700
@@ -703,6 +703,8 @@ static int init(void * unused)
 
 	do_pre_smp_initcalls();
 
+	numa_default_policy();
+
 	smp_init();
 	sched_init_smp();
 
@@ -738,7 +740,6 @@ static int init(void * unused)
 	unlock_kernel();
 	mark_rodata_ro();
 	system_state = SYSTEM_RUNNING;
-	numa_default_policy();
 
 	if (sys_open((const char __user *) "/dev/console", O_RDWR, 0) < 0)
 		printk(KERN_WARNING "Warning: unable to open an initial console.\n");

                 reply	other threads:[~2006-10-03  2:47 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=20061003024914.GA4071@localhost.localdomain \
    --to=kiran@scalex86.org \
    --cc=akpm@osdl.org \
    --cc=alok.kataria@calsoftinc.com \
    --cc=benzi@scalemp.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=shai@scalex86.org \
    /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