From: Miao Xie <miaox@cn.fujitsu.com>
To: Yasunori Goto <y-goto@jp.fujitsu.com>
Cc: Paul Menage <menage@google.com>,
Linux-Kernel <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] cpuset: update top cpuset's mems after adding a node
Date: Mon, 10 Nov 2008 15:37:45 +0800 [thread overview]
Message-ID: <4917E4C9.5060900@cn.fujitsu.com> (raw)
In-Reply-To: <20081110155231.F82E.E1E9C6FF@jp.fujitsu.com>
on 2008-11-10 14:56 Yasunori Goto wrote:
> Did you test this patch? Was it OK?
Sorry. I forget.
I will do it as soon as possible.
> If yes,
> Acked-by: Yasunori Goto <y-goto@jp.fujitsu.com>
>
>
> Thanks.
>
>
>> After adding a node into the machine, top cpuset's mems isn't updated.
>>
>> By reviewing the code, we found that the update function
>> cpuset_track_online_nodes()
>> was invoked after node_states[N_ONLINE] changes. It is wrong because N_ONLINE
>> just means node has pgdat, and if node has/added memory, we use N_HIGH_MEMORY.
>> So, We should invoke the update function after node_states[N_HIGH_MEMORY]
>> changes, just like its commit says.
>>
>> This patch fixes it. And we use notifier of memory hotplug instead of direct
>> calling of cpuset_track_online_nodes().
>>
>> Signed-off-by: Miao Xie <miaox@cn.fujitsu.com>
>> Cc: Yasunori Goto <y-goto@jp.fujitsu.com>
>>
>> ---
>> include/linux/cpuset.h | 4 ----
>> kernel/cpuset.c | 19 ++++++++++++++++---
>> mm/memory_hotplug.c | 3 ---
>> 3 files changed, 16 insertions(+), 10 deletions(-)
>>
>> diff --git a/include/linux/cpuset.h b/include/linux/cpuset.h
>> index 2691926..8e540d3 100644
>> --- a/include/linux/cpuset.h
>> +++ b/include/linux/cpuset.h
>> @@ -74,8 +74,6 @@ static inline int cpuset_do_slab_mem_spread(void)
>> return current->flags & PF_SPREAD_SLAB;
>> }
>>
>> -extern void cpuset_track_online_nodes(void);
>> -
>> extern int current_cpuset_is_being_rebound(void);
>>
>> extern void rebuild_sched_domains(void);
>> @@ -151,8 +149,6 @@ static inline int cpuset_do_slab_mem_spread(void)
>> return 0;
>> }
>>
>> -static inline void cpuset_track_online_nodes(void) {}
>> -
>> static inline int current_cpuset_is_being_rebound(void)
>> {
>> return 0;
>> diff --git a/kernel/cpuset.c b/kernel/cpuset.c
>> index 3e00526..909a548 100644
>> --- a/kernel/cpuset.c
>> +++ b/kernel/cpuset.c
>> @@ -36,6 +36,7 @@
>> #include <linux/list.h>
>> #include <linux/mempolicy.h>
>> #include <linux/mm.h>
>> +#include <linux/memory.h>
>> #include <linux/module.h>
>> #include <linux/mount.h>
>> #include <linux/namei.h>
>> @@ -2011,12 +2012,23 @@ static int cpuset_track_online_cpus(struct notifier_block *unused_nb,
>> * Call this routine anytime after node_states[N_HIGH_MEMORY] changes.
>> * See also the previous routine cpuset_track_online_cpus().
>> */
>> -void cpuset_track_online_nodes(void)
>> +static int cpuset_track_online_nodes(struct notifier_block *self,
>> + unsigned long action, void *arg)
>> {
>> cgroup_lock();
>> - top_cpuset.mems_allowed = node_states[N_HIGH_MEMORY];
>> - scan_for_empty_cpusets(&top_cpuset);
>> + switch (action) {
>> + case MEM_ONLINE:
>> + top_cpuset.mems_allowed = node_states[N_HIGH_MEMORY];
>> + break;
>> + case MEM_OFFLINE:
>> + top_cpuset.mems_allowed = node_states[N_HIGH_MEMORY];
>> + scan_for_empty_cpusets(&top_cpuset);
>> + break;
>> + default:
>> + break;
>> + }
>> cgroup_unlock();
>> + return NOTIFY_OK;
>> }
>> #endif
>>
>> @@ -2032,6 +2044,7 @@ void __init cpuset_init_smp(void)
>> top_cpuset.mems_allowed = node_states[N_HIGH_MEMORY];
>>
>> hotcpu_notifier(cpuset_track_online_cpus, 0);
>> + hotplug_memory_notifier(cpuset_track_online_nodes, 10);
>> }
>>
>> /**
>> diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c
>> index 6837a10..b5b2b15 100644
>> --- a/mm/memory_hotplug.c
>> +++ b/mm/memory_hotplug.c
>> @@ -22,7 +22,6 @@
>> #include <linux/highmem.h>
>> #include <linux/vmalloc.h>
>> #include <linux/ioport.h>
>> -#include <linux/cpuset.h>
>> #include <linux/delay.h>
>> #include <linux/migrate.h>
>> #include <linux/page-isolation.h>
>> @@ -498,8 +497,6 @@ int add_memory(int nid, u64 start, u64 size)
>> /* we online node here. we can't roll back from here. */
>> node_set_online(nid);
>>
>> - cpuset_track_online_nodes();
>> -
>> if (new_pgdat) {
>> ret = register_one_node(nid);
>> /*
>> --
>> 1.5.3.8
>>
>
next prev parent reply other threads:[~2008-11-10 7:42 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-11-10 6:41 [PATCH] cpuset: update top cpuset's mems after adding a node Miao Xie
2008-11-10 6:56 ` Yasunori Goto
2008-11-10 7:37 ` Miao Xie [this message]
2008-11-10 12:28 ` Miao Xie
2008-11-10 20:26 ` David Rientjes
2008-11-11 1:48 ` Yasunori Goto
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=4917E4C9.5060900@cn.fujitsu.com \
--to=miaox@cn.fujitsu.com \
--cc=linux-kernel@vger.kernel.org \
--cc=menage@google.com \
--cc=y-goto@jp.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.