From: Greg KH <gregkh@linuxfoundation.org>
To: Neil Zhang <zhangwm@marvell.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH] drivers: base: update cpu offline info when do hotplug
Date: Mon, 20 Oct 2014 12:43:40 +0800 [thread overview]
Message-ID: <20141020044340.GA9589@kroah.com> (raw)
In-Reply-To: <1413775748-22478-1-git-send-email-zhangwm@marvell.com>
On Mon, Oct 20, 2014 at 11:29:08AM +0800, Neil Zhang wrote:
> The current per-cpu offline info won't be updated if it is
> hotplugged in/out by a kernel governer.
> Let's update it via cpu notifier.
>
> Signed-off-by: Neil Zhang <zhangwm@marvell.com>
> ---
> drivers/base/cpu.c | 25 +++++++++++++++++++++++++
> 1 file changed, 25 insertions(+)
>
> diff --git a/drivers/base/cpu.c b/drivers/base/cpu.c
> index 006b1bc..9d61824 100644
> --- a/drivers/base/cpu.c
> +++ b/drivers/base/cpu.c
> @@ -418,10 +418,35 @@ static void __init cpu_dev_register_generic(void)
> #endif
> }
>
> +static int device_hotplug_notifier(struct notifier_block *nfb,
> + unsigned long action, void *hcpu)
> +{
> + unsigned int cpu = (unsigned long)hcpu;
> + struct device *dev = get_cpu_device(cpu);
> + int ret;
> +
> + switch (action & ~CPU_TASKS_FROZEN) {
> + case CPU_ONLINE:
> + dev->offline = false;
> + ret = NOTIFY_OK;
> + break;
> + case CPU_DYING:
> + dev->offline = true;
> + ret = NOTIFY_OK;
> + break;
> + default:
> + ret = NOTIFY_DONE;
> + break;
> + }
> +
> + return ret;
> +}
> +
> void __init cpu_dev_init(void)
> {
> if (subsys_system_register(&cpu_subsys, cpu_root_attr_groups))
> panic("Failed to register CPU subsystem");
>
> cpu_dev_register_generic();
> + cpu_notifier(device_hotplug_notifier, 0);
> }
How much noise is this going to cause on a big/little system that
constantly hot unplug/plugs processors all of the time?
greg k-h
next prev parent reply other threads:[~2014-10-20 4:44 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-10-20 3:29 [PATCH] drivers: base: update cpu offline info when do hotplug Neil Zhang
2014-10-20 4:43 ` Greg KH [this message]
2014-10-20 6:39 ` Neil Zhang
2014-10-20 6:48 ` Greg KH
2014-10-20 7:40 ` Neil Zhang
2014-10-20 17:02 ` Dan Streetman
2014-10-21 0:47 ` Neil Zhang
2014-10-21 2:57 ` Yasuaki Ishimatsu
2014-10-21 3:18 ` Neil Zhang
2014-10-21 3:26 ` Yasuaki Ishimatsu
2014-10-21 3:36 ` Neil Zhang
2014-10-21 4:47 ` Yasuaki Ishimatsu
2014-10-21 12:58 ` Dan Streetman
2014-10-27 1:43 ` Neil Zhang
2014-10-27 1:58 ` Greg KH
2014-10-27 2:17 ` Neil Zhang
2014-10-27 2:26 ` Greg KH
2014-10-27 2:30 ` Neil Zhang
2014-10-27 16:28 ` Dan Streetman
2014-10-21 13:02 ` Dan Streetman
2014-10-22 1:32 ` Neil Zhang
2014-10-23 14:05 ` Dan Streetman
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=20141020044340.GA9589@kroah.com \
--to=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=zhangwm@marvell.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