From: Wen Congyang <wency@cn.fujitsu.com>
To: David Rientjes <rientjes@google.com>
Cc: Tang Chen <tangchen@cn.fujitsu.com>,
mingo@redhat.com, peterz@infradead.org, miaox@cn.fujitsu.com,
linux-kernel@vger.kernel.org, linux-numa@vger.kernel.org
Subject: Re: [PATCH] Do not use cpu_to_node() to find an offlined cpu's node.
Date: Tue, 09 Oct 2012 16:34:18 +0800 [thread overview]
Message-ID: <5073E18A.2090203@cn.fujitsu.com> (raw)
In-Reply-To: <alpine.DEB.2.00.1210082308230.360@chino.kir.corp.google.com>
At 10/09/2012 02:21 PM, David Rientjes Wrote:
> On Mon, 8 Oct 2012, Tang Chen wrote:
>
>> diff --git a/kernel/sched/core.c b/kernel/sched/core.c
>> index 66b36ab..e76dce9 100644
>> --- a/kernel/sched/core.c
>> +++ b/kernel/sched/core.c
>> @@ -1263,18 +1263,24 @@ EXPORT_SYMBOL_GPL(kick_process);
>> */
>> static int select_fallback_rq(int cpu, struct task_struct *p)
>> {
>> - const struct cpumask *nodemask = cpumask_of_node(cpu_to_node(cpu));
>> + int nid = cpu_to_node(cpu);
>> + const struct cpumask *nodemask = NULL;
>> enum { cpuset, possible, fail } state = cpuset;
>> int dest_cpu;
>>
>> - /* Look for allowed, online CPU in same node. */
>> - for_each_cpu(dest_cpu, nodemask) {
>> - if (!cpu_online(dest_cpu))
>> - continue;
>> - if (!cpu_active(dest_cpu))
>> - continue;
>> - if (cpumask_test_cpu(dest_cpu, tsk_cpus_allowed(p)))
>> - return dest_cpu;
>> + /* If the cpu has been offlined, its nid was set to -1. */
>> + if (nid != -1) {
>
> NUMA_NO_NODE.
>
> Eek, the nid shouldn't be -1 yet, though, for cpu hotplug since this
> should be called at CPU_DYING level and migrate_tasks() still sees a valid
> cpu.
the cpu's node is set when the cpu is hotpluged(not online), and it will
be cleared when the cpu is hotremoved(This patch is in akpm tree):
https://lkml.org/lkml/2012/9/3/39
I guess the task is in sleep state when the cpu is offlined, and it doesn't
be migrated to another cpu.
Thanks
Wen Congyang
>
> On x86, cpumask_of_node() is always guaranteed to return a valid cpumask
> after boot so presumably this is a problem in some non-x86 arch code and
> isn't actually a sched problem.
>
>> + nodemask = cpumask_of_node(nid);
>> +
>> + /* Look for allowed, online CPU in same node. */
>> + for_each_cpu(dest_cpu, nodemask) {
>> + if (!cpu_online(dest_cpu))
>> + continue;
>> + if (!cpu_active(dest_cpu))
>> + continue;
>> + if (cpumask_test_cpu(dest_cpu, tsk_cpus_allowed(p)))
>> + return dest_cpu;
>> + }
>> }
>>
>> for (;;) {
>
next prev parent reply other threads:[~2012-10-09 8:28 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-10-08 2:59 [PATCH] Do not use cpu_to_node() to find an offlined cpu's node Tang Chen
2012-10-09 6:21 ` David Rientjes
2012-10-09 8:34 ` Wen Congyang [this message]
2012-10-09 8:39 ` Tang Chen
2012-10-09 10:04 ` David Rientjes
2012-10-09 10:22 ` Wen Congyang
2012-10-09 20:00 ` David Rientjes
2012-10-09 10:57 ` Peter Zijlstra
2012-10-09 20:36 ` David Rientjes
2012-10-09 20:47 ` Peter Zijlstra
2012-10-09 23:27 ` David Rientjes
2012-10-10 2:06 ` Wen Congyang
2012-10-10 3:48 ` Wen Congyang
2012-10-10 9:10 ` Peter Zijlstra
2012-10-10 9:33 ` Wen Congyang
2012-10-10 9:51 ` Peter Zijlstra
2012-10-10 10:10 ` Wen Congyang
2012-10-10 10:07 ` Peter Zijlstra
2012-10-10 20:30 ` David Rientjes
2012-10-10 20:37 ` Andrew Morton
2012-10-10 20:57 ` David Rientjes
2012-10-18 0:52 ` David Rientjes
2012-10-18 2:51 ` Tang Chen
2012-10-18 3:29 ` David Rientjes
2012-10-19 11:18 ` Peter Zijlstra
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=5073E18A.2090203@cn.fujitsu.com \
--to=wency@cn.fujitsu.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-numa@vger.kernel.org \
--cc=miaox@cn.fujitsu.com \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=rientjes@google.com \
--cc=tangchen@cn.fujitsu.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