linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: KOSAKI Motohiro <kosaki.motohiro@gmail.com>
To: Yasuaki Ishimatsu <isimatu.yasuaki@jp.fujitsu.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: Thu, 18 Apr 2013 09:32:58 -0700	[thread overview]
Message-ID: <CAHGf_=qcV=R_O5fpjpRQh5Tu9=nz1jVR9r=55fYODds8TQm7vw@mail.gmail.com> (raw)
In-Reply-To: <516FA0B9.8080308@jp.fujitsu.com>

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


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


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

--
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-18 16:33 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 [this message]
2013-04-19  1:17   ` Yasuaki Ishimatsu

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='CAHGf_=qcV=R_O5fpjpRQh5Tu9=nz1jVR9r=55fYODds8TQm7vw@mail.gmail.com' \
    --to=kosaki.motohiro@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=hpa@zytor.com \
    --cc=isimatu.yasuaki@jp.fujitsu.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