From: Lai Jiangshan <laijs@cn.fujitsu.com>
To: "Frédéric Weisbecker" <fweisbec@gmail.com>
Cc: Steven Rostedt <rostedt@goodmis.org>, Ingo Molnar <mingo@elte.hu>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH -tip] trace_workqueue: use percpu data for workqueue stat
Date: Fri, 16 Jan 2009 16:11:51 +0800 [thread overview]
Message-ID: <49704147.6000003@cn.fujitsu.com> (raw)
In-Reply-To: <c62985530901150509we244b70l4e7af5c6b6145f30@mail.gmail.com>
Frédéric Weisbecker wrote:
> Hi Lai,
>
> 2009/1/15 Lai Jiangshan <laijs@cn.fujitsu.com>:
>> Impact: make trace_workqueue works well on NUMA
>>
>> It's not correct when (num_possible_cpus() < nr_cpumask_bits):
>> all_workqueue_stat = kmalloc(sizeof(struct workqueue_global_stats)
>> * num_possible_cpus(), GFP_KERNEL);
>
>
> What is the difference between num_possible_cpus() and nr_cpumask_bits actually?
> It looks like nr_cpumask_bits binds to NR_CPUS on early time and after
> it is set to
> num_possible_cpus() , right?
> In this case num_possible_cpus() seems more relevant...no?
>
> (I'm pretty sure I'm wrong.... :-)
>
I wanted to reference to nr_cpu_ids, not nr_cpumask_bits(I made mistake yesterday)
init/main.c
static void __init setup_nr_cpu_ids(void)
{
nr_cpu_ids = find_last_bit(cpumask_bits(cpu_possible_mask),NR_CPUS) + 1;
}
setup_nr_cpu_ids() is called directly in main.c, it's earlier than early_initcall.
So nr_cpu_ids is better than num_possible_cpus(), for maybe cpu_possible_mask=101B
nr_cpu_ids=3, num_possible_cpus()=2, We will access to invalid memory when we use
num_possible_cpus().
but percpu data as my patch shows is better than nr_cpu_ids.
Thanks, Lai.
next prev parent reply other threads:[~2009-01-16 8:12 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-01-15 12:01 [PATCH -tip] trace_workqueue: use percpu data for workqueue stat Lai Jiangshan
2009-01-15 13:09 ` Frédéric Weisbecker
2009-01-16 8:11 ` Lai Jiangshan [this message]
2009-01-16 8:49 ` Frederic Weisbecker
2009-01-16 8:58 ` Frederic Weisbecker
2009-01-16 8:32 ` Lai Jiangshan
2009-01-16 9:05 ` Frederic Weisbecker
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=49704147.6000003@cn.fujitsu.com \
--to=laijs@cn.fujitsu.com \
--cc=fweisbec@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=rostedt@goodmis.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