From: Andrew Morton <akpm@linux-foundation.org>
To: Toshi Kani <toshi.kani@hp.com>
Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org,
Christoph Lameter <cl@linux-foundation.org>,
Yasuaki Ishimatsu <isimatu.yasuaki@jp.fujitsu.com>
Subject: Re: [PATCH] mm: Set N_CPU to node_states during boot
Date: Mon, 14 Oct 2013 16:10:47 -0700 [thread overview]
Message-ID: <20131014161047.4a6a54e985d68a9f1ce7234b@linux-foundation.org> (raw)
In-Reply-To: <1381781096-13168-1-git-send-email-toshi.kani@hp.com>
On Mon, 14 Oct 2013 14:04:56 -0600 Toshi Kani <toshi.kani@hp.com> wrote:
> After a system booted, N_CPU is not set to any node as has_cpu
> shows an empty line.
>
> # cat /sys/devices/system/node/has_cpu
> (show-empty-line)
>
> setup_vmstat() registers its CPU notifier callback,
> vmstat_cpuup_callback(), which marks N_CPU to a node when
> a CPU is put into online. However, setup_vmstat() is called
> after all CPUs are launched in the boot sequence.
>
> Change setup_vmstat() to mark N_CPU to the nodes with online
> CPUs at boot.
>
> ...
>
> --- a/mm/vmstat.c
> +++ b/mm/vmstat.c
> @@ -1276,8 +1276,10 @@ static int __init setup_vmstat(void)
>
> register_cpu_notifier(&vmstat_notifier);
>
> - for_each_online_cpu(cpu)
> + for_each_online_cpu(cpu) {
> start_cpu_timer(cpu);
> + node_set_state(cpu_to_node(cpu), N_CPU);
> + }
> #endif
> #ifdef CONFIG_PROC_FS
> proc_create("buddyinfo", S_IRUGO, NULL, &fragmentation_file_operations);
This seems a bit hacky. Would it not be better to register
vmstat_notifier() before bringing up CPUs?
And this patch might be racy as well - what happens if a CPU comes up
and goes down again before setup_vmstat() is called?
(Where does N_CPU get cleared? It doesn't, afaict. Should we clear it
if a node's final CPU goes offline?)
--
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>
next prev parent reply other threads:[~2013-10-14 23:10 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-10-14 20:04 [PATCH] mm: Set N_CPU to node_states during boot Toshi Kani
2013-10-14 23:10 ` Andrew Morton [this message]
2013-10-15 0:00 ` Toshi Kani
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=20131014161047.4a6a54e985d68a9f1ce7234b@linux-foundation.org \
--to=akpm@linux-foundation.org \
--cc=cl@linux-foundation.org \
--cc=isimatu.yasuaki@jp.fujitsu.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=toshi.kani@hp.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;
as well as URLs for NNTP newsgroup(s).