aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/cpuset.c
diff options
context:
space:
mode:
authorLi Zefan <lizefan@huawei.com>2013-03-01 02:02:15 -0500
committerTejun Heo <tj@kernel.org>2013-03-04 12:50:08 -0500
commitf440d98f8ebab02a768c1de17395e4239af9a97d (patch)
tree06ea2d293e51962fa63bd554b7e1a0819fe8de8a /kernel/cpuset.c
parent65dff759d2948cf18e2029fc5c0c595b8b7da3a5 (diff)
cpuset: use cgroup_name() in cpuset_print_task_mems_allowed()
Use cgroup_name() instead of cgrp->dentry->name. This makes the code a bit simpler. While at it, remove cpuset_name and make cpuset_nodelist a local variable to cpuset_print_task_mems_allowed(). Signed-off-by: Li Zefan <lizefan@huawei.com> Signed-off-by: Tejun Heo <tj@kernel.org>
Diffstat (limited to 'kernel/cpuset.c')
-rw-r--r--kernel/cpuset.c32
1 files changed, 9 insertions, 23 deletions
diff --git a/kernel/cpuset.c b/kernel/cpuset.c
index 4f9dfe43ecbd..ace5bfcdcb30 100644
--- a/kernel/cpuset.c
+++ b/kernel/cpuset.c
@@ -265,17 +265,6 @@ static DEFINE_MUTEX(cpuset_mutex);
265static DEFINE_MUTEX(callback_mutex); 265static DEFINE_MUTEX(callback_mutex);
266 266
267/* 267/*
268 * cpuset_buffer_lock protects both the cpuset_name and cpuset_nodelist
269 * buffers. They are statically allocated to prevent using excess stack
270 * when calling cpuset_print_task_mems_allowed().
271 */
272#define CPUSET_NAME_LEN (128)
273#define CPUSET_NODELIST_LEN (256)
274static char cpuset_name[CPUSET_NAME_LEN];
275static char cpuset_nodelist[CPUSET_NODELIST_LEN];
276static DEFINE_SPINLOCK(cpuset_buffer_lock);
277
278/*
279 * CPU / memory hotplug is handled asynchronously. 268 * CPU / memory hotplug is handled asynchronously.
280 */ 269 */
281static struct workqueue_struct *cpuset_propagate_hotplug_wq; 270static struct workqueue_struct *cpuset_propagate_hotplug_wq;
@@ -2592,6 +2581,8 @@ int cpuset_mems_allowed_intersects(const struct task_struct *tsk1,
2592 return nodes_intersects(tsk1->mems_allowed, tsk2->mems_allowed); 2581 return nodes_intersects(tsk1->mems_allowed, tsk2->mems_allowed);
2593} 2582}
2594 2583
2584#define CPUSET_NODELIST_LEN (256)
2585
2595/** 2586/**
2596 * cpuset_print_task_mems_allowed - prints task's cpuset and mems_allowed 2587 * cpuset_print_task_mems_allowed - prints task's cpuset and mems_allowed
2597 * @task: pointer to task_struct of some task. 2588 * @task: pointer to task_struct of some task.
@@ -2602,24 +2593,19 @@ int cpuset_mems_allowed_intersects(const struct task_struct *tsk1,
2602 */ 2593 */
2603void cpuset_print_task_mems_allowed(struct task_struct *tsk) 2594void cpuset_print_task_mems_allowed(struct task_struct *tsk)
2604{ 2595{
2605 struct dentry *dentry; 2596 /* Statically allocated to prevent using excess stack. */
2597 static char cpuset_nodelist[CPUSET_NODELIST_LEN];
2598 static DEFINE_SPINLOCK(cpuset_buffer_lock);
2606 2599
2607 dentry = task_cs(tsk)->css.cgroup->dentry; 2600 struct cgroup *cgrp = task_cs(tsk)->css.cgroup;
2608 spin_lock(&cpuset_buffer_lock);
2609 2601
2610 if (!dentry) { 2602 spin_lock(&cpuset_buffer_lock);
2611 strcpy(cpuset_name, "/");
2612 } else {
2613 spin_lock(&dentry->d_lock);
2614 strlcpy(cpuset_name, (const char *)dentry->d_name.name,
2615 CPUSET_NAME_LEN);
2616 spin_unlock(&dentry->d_lock);
2617 }
2618 2603
2619 nodelist_scnprintf(cpuset_nodelist, CPUSET_NODELIST_LEN, 2604 nodelist_scnprintf(cpuset_nodelist, CPUSET_NODELIST_LEN,
2620 tsk->mems_allowed); 2605 tsk->mems_allowed);
2621 printk(KERN_INFO "%s cpuset=%s mems_allowed=%s\n", 2606 printk(KERN_INFO "%s cpuset=%s mems_allowed=%s\n",
2622 tsk->comm, cpuset_name, cpuset_nodelist); 2607 tsk->comm, cgroup_name(cgrp), cpuset_nodelist);
2608
2623 spin_unlock(&cpuset_buffer_lock); 2609 spin_unlock(&cpuset_buffer_lock);
2624} 2610}
2625 2611