linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Yasuaki Ishimatsu <isimatu.yasuaki@jp.fujitsu.com>
To: KOSAKI Motohiro <kosaki.motohiro@gmail.com>
Cc: Ingo Molnar <mingo@kernel.org>, "H. Peter Anvin" <hpa@zytor.com>,
	"Srivatsa S. Bhat" <srivatsa.bhat@linux.vnet.ibm.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	LKML <linux-kernel@vger.kernel.org>,
	x86@kernel.org, "linux-mm@kvack.org" <linux-mm@kvack.org>
Subject: Re: [Bug fix PATCH] numa, cpu hotplug: Change links of CPU and node when changing node number by onlining CPU
Date: Fri, 19 Apr 2013 10:17:01 +0900	[thread overview]
Message-ID: <51709B0D.9000900@jp.fujitsu.com> (raw)
In-Reply-To: <CAHGf_=qcV=R_O5fpjpRQh5Tu9=nz1jVR9r=55fYODds8TQm7vw@mail.gmail.com>

2013/04/19 1:32, KOSAKI Motohiro wrote:
>>   #ifdef CONFIG_HOTPLUG_CPU
>> +static void change_cpu_under_node(struct cpu *cpu,
>> +                       unsigned int from_nid, unsigned int to_nid)
>> +{
>> +       int cpuid = cpu->dev.id;
>> +       unregister_cpu_under_node(cpuid, from_nid);
>> +       register_cpu_under_node(cpuid, to_nid);
>> +       cpu->node_id = to_nid;
>> +}
>> +
>

> Where is stub for !CONFIG_HOTPLUG_CPU?

This function is called by only store_online(). And the store_online() is
defined only when CONFIG_HOTPLUG_CPU enables. Thus change_cpu_under_node()
is not necessary for !CONFIG_HOTPLUG_CPU.

>
>
>>   static ssize_t show_online(struct device *dev,
>>                             struct device_attribute *attr,
>>                             char *buf)
>> @@ -39,17 +48,23 @@ static ssize_t __ref store_online(struct device *dev,
>>                                    const char *buf, size_t count)
>>   {
>>          struct cpu *cpu = container_of(dev, struct cpu, dev);
>> +       int num = cpu->dev.id;
>

> "num" is wrong name. cpuid may be better.

I'll update it.

>
>
>> +       int from_nid, to_nid;
>>          ssize_t ret;
>>
>>          cpu_hotplug_driver_lock();
>>          switch (buf[0]) {
>>          case '0':
>> -               ret = cpu_down(cpu->dev.id);
>> +               ret = cpu_down(num);
>>                  if (!ret)
>>                          kobject_uevent(&dev->kobj, KOBJ_OFFLINE);
>>                  break;
>>          case '1':
>> -               ret = cpu_up(cpu->dev.id);
>> +               from_nid = cpu_to_node(num);
>> +               ret = cpu_up(num);
>> +               to_nid = cpu_to_node(num);
>> +               if (from_nid != to_nid)
>> +                       change_cpu_under_node(cpu, from_nid, to_nid);
>
> You need to add several comments. this code is not straightforward.

O.K. I'll update it.

Thanks,
Yasuaki Ishimatsu


--
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>

      reply	other threads:[~2013-04-19  1:17 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-18  7:28 Yasuaki Ishimatsu
2013-04-18 16:32 ` KOSAKI Motohiro
2013-04-19  1:17   ` Yasuaki Ishimatsu [this message]

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=51709B0D.9000900@jp.fujitsu.com \
    --to=isimatu.yasuaki@jp.fujitsu.com \
    --cc=akpm@linux-foundation.org \
    --cc=hpa@zytor.com \
    --cc=kosaki.motohiro@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mingo@kernel.org \
    --cc=srivatsa.bhat@linux.vnet.ibm.com \
    --cc=x86@kernel.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