linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: Andi Kleen <andi@firstfloor.org>
Cc: tglx@linutronix.de, linux-kernel@vger.kernel.org,
	Andi Kleen <ak@linux.intel.com>
Subject: Re: [PATCH] Allocate idle task for a CPU always on its local node
Date: Tue, 17 May 2016 14:13:08 -0700	[thread overview]
Message-ID: <20160517141308.8a2df2028d19d375d3660e1f@linux-foundation.org> (raw)
In-Reply-To: <1463492694-15833-1-git-send-email-andi@firstfloor.org>

On Tue, 17 May 2016 06:44:54 -0700 Andi Kleen <andi@firstfloor.org> wrote:

> From: Andi Kleen <ak@linux.intel.com>
> 
> Linux pre-allocates the task structs of the idle tasks for all possible CPUs.
> This currently means they all end up on node 0. This also implies
> that the cache line of MWAIT, which is around the flags field in the task
> struct, are all located in node 0.
> 
> We see a noticeable performance improvement on Knights Landing CPUs when
> the cache lines used for MWAIT are located in the local nodes of the CPUs
> using them. I would expect this to give a (likely slight) improvement
> on other systems too.
> 
> The patch implements placing the idle task in the node of
> its CPUs, by passing the right target node to copy_process()
> 

Looks nice.

This is nicer ;)


From: Andrew Morton <akpm@linux-foundation.org>
Subject: allocate-idle-task-for-a-cpu-always-on-its-local-node-fix

use NUMA_NO_NODE, not a bare -1

Cc: Andi Kleen <ak@linux.intel.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---

 kernel/fork.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff -puN kernel/fork.c~allocate-idle-task-for-a-cpu-always-on-its-local-node-fix kernel/fork.c
--- a/kernel/fork.c~allocate-idle-task-for-a-cpu-always-on-its-local-node-fix
+++ a/kernel/fork.c
@@ -346,7 +346,7 @@ static struct task_struct *dup_task_stru
 	struct thread_info *ti;
 	int err;
 
-	if (node < 0)
+	if (node == NUMA_NO_NODE)
 		node = tsk_fork_get_node(orig);
 	tsk = alloc_task_struct_node(node);
 	if (!tsk)
@@ -1754,7 +1754,7 @@ long _do_fork(unsigned long clone_flags,
 	}
 
 	p = copy_process(clone_flags, stack_start, stack_size,
-			 child_tidptr, NULL, trace, tls, -1);
+			 child_tidptr, NULL, trace, tls, NUMA_NO_NODE);
 	/*
 	 * Do this prior waking up the new thread - the thread pointer
 	 * might get invalid after that point, if the thread exits quickly.
_

  reply	other threads:[~2016-05-17 21:13 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-17 13:44 [PATCH] Allocate idle task for a CPU always on its local node Andi Kleen
2016-05-17 21:13 ` Andrew Morton [this message]
2016-05-17 21:50   ` Andi Kleen
2016-05-18  8:28 ` Thomas Gleixner

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=20160517141308.8a2df2028d19d375d3660e1f@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=ak@linux.intel.com \
    --cc=andi@firstfloor.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tglx@linutronix.de \
    /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;
as well as URLs for NNTP newsgroup(s).