From: maeda.naoaki@jp.fujitsu.com
To: linux-kernel@vger.kernel.org, ckrm-tech@lists.sourceforge.net
Cc: maeda.naoaki@jp.fujitsu.com
Subject: [RFC][PATCH 8/9] CPU controller - Adds cpu hotplug notifier
Date: Fri, 21 Apr 2006 11:28:08 +0900 [thread overview]
Message-ID: <20060421022808.13598.60372.sendpatchset@moscone.dvs.cs.fujitsu.co.jp> (raw)
In-Reply-To: <20060421022727.13598.15397.sendpatchset@moscone.dvs.cs.fujitsu.co.jp>
8/9: ckrm_cpu_hotplug
Adds cpu hotplug notifier for the CKRM CPU controller.
Signed-off-by: MAEDA Naoaki <maeda.naoaki@jp.fujitsu.com>
Signed-off-by: Kurosawa Takahiro <kurosawa@valinux.co.jp>
kernel/ckrm/ckrm_cpu.c | 50 +++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 50 insertions(+)
Index: linux-2.6.17-rc2/kernel/ckrm/ckrm_cpu.c
===================================================================
--- linux-2.6.17-rc2.orig/kernel/ckrm/ckrm_cpu.c
+++ linux-2.6.17-rc2/kernel/ckrm/ckrm_cpu.c
@@ -243,12 +243,61 @@ struct ckrm_controller cpu_ctlr = {
.show_stats = cpu_show_stats,
};
+static void clear_stat_and_propagate(struct ckrm_cpu * res, int cpu)
+{
+ struct ckrm_class *child = NULL;
+ struct ckrm_cpu *childres;
+
+ cpu_rc_clear_stat(&res->cpu_rc, cpu);
+
+ /* propagate to children */
+ spin_lock(&res->class->class_lock);
+ for_each_child(child, res->class) {
+ childres = get_class_cpu(child);
+ if (childres) {
+ spin_lock(&child->class_lock);
+ clear_stat_and_propagate(childres, cpu);
+ spin_unlock(&child->class_lock);
+ }
+ }
+ spin_unlock(&res->class->class_lock);
+}
+
+static int __devinit ckrm_cpu_notify(struct notifier_block *self,
+ unsigned long action, void *hcpu)
+{
+ struct ckrm_class *cls = &ckrm_default_class;
+ struct ckrm_cpu *res;
+ int cpu = (long) hcpu;
+
+ switch (action) {
+
+ case CPU_DEAD:
+ res = get_class_cpu(cls);
+ clear_stat_and_propagate(res, cpu);
+ /* FALL THROUGH */
+ case CPU_ONLINE:
+ grcd.cpus = cpu_online_map;
+ grcd.numcpus = cpus_weight(cpu_online_map);
+ break;
+ default:
+ break;
+ }
+ return NOTIFY_OK;
+}
+
+static struct notifier_block ckrm_cpu_nb = {
+ .notifier_call = ckrm_cpu_notify,
+};
+
int __init init_ckrm_cpu_res(void)
{
if (cpu_ctlr.ctlr_id != CKRM_NO_RES_ID)
return -EBUSY; /* already registered */
cpu_rc_init_rcd(&grcd);
printk(KERN_INFO "init_ckrm_cpu_res %d cpus available\n", grcd.numcpus);
+ /* Register notifier for non-boot CPUs */
+ register_cpu_notifier(&ckrm_cpu_nb);
return ckrm_register_controller(&cpu_ctlr);
}
@@ -259,6 +308,7 @@ void __exit exit_ckrm_cpu_res(void)
rc = ckrm_unregister_controller(&cpu_ctlr);
} while (rc == -EBUSY);
BUG_ON(rc != 0);
+ unregister_cpu_notifier(&ckrm_cpu_nb);
}
module_init(init_ckrm_cpu_res)
next prev parent reply other threads:[~2006-04-21 2:29 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-04-21 2:27 [RFC][PATCH 0/9] CKRM CPU resource controller maeda.naoaki
2006-04-21 2:27 ` [RFC][PATCH 1/9] CPU controller - Adds class load estimation maeda.naoaki
2006-04-21 2:27 ` [RFC][PATCH 2/9] CPU controller - Adds class hungry detection maeda.naoaki
2006-04-21 2:27 ` [RFC][PATCH 3/9] CPU controller - Adds timeslice scaling maeda.naoaki
2006-04-21 8:17 ` Mike Galbraith
2006-04-21 8:56 ` MAEDA Naoaki
2006-04-21 11:50 ` [ckrm-tech] " Naoaki MAEDA
2006-04-21 12:03 ` Mike Galbraith
2006-04-21 11:53 ` Mike Galbraith
2006-04-21 2:27 ` [RFC][PATCH 4/9] CPU controller - Adds interface functions maeda.naoaki
2006-04-21 2:27 ` [RFC][PATCH 5/9] CPU controller - Documents how the controller works maeda.naoaki
2006-04-23 7:13 ` Mike Galbraith
2006-04-24 6:25 ` [ckrm-tech] " MAEDA Naoaki
2006-04-24 9:49 ` Mike Galbraith
2006-04-21 2:27 ` [RFC][PATCH 6/9] CPU controller - Adds basic functions and registering the controller maeda.naoaki
2006-04-21 2:28 ` [RFC][PATCH 7/9] CPU controller - Adds routines to change share values and show stat maeda.naoaki
2006-04-21 2:28 ` maeda.naoaki [this message]
2006-04-21 2:28 ` [RFC][PATCH 9/9] CPU controller - Documents how to use the controller maeda.naoaki
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=20060421022808.13598.60372.sendpatchset@moscone.dvs.cs.fujitsu.co.jp \
--to=maeda.naoaki@jp.fujitsu.com \
--cc=ckrm-tech@lists.sourceforge.net \
--cc=linux-kernel@vger.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