diff options
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/cpuset.c | 32 |
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); | |||
265 | static DEFINE_MUTEX(callback_mutex); | 265 | static 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) | ||
274 | static char cpuset_name[CPUSET_NAME_LEN]; | ||
275 | static char cpuset_nodelist[CPUSET_NODELIST_LEN]; | ||
276 | static DEFINE_SPINLOCK(cpuset_buffer_lock); | ||
277 | |||
278 | /* | ||
279 | * CPU / memory hotplug is handled asynchronously. | 268 | * CPU / memory hotplug is handled asynchronously. |
280 | */ | 269 | */ |
281 | static struct workqueue_struct *cpuset_propagate_hotplug_wq; | 270 | static 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 | */ |
2603 | void cpuset_print_task_mems_allowed(struct task_struct *tsk) | 2594 | void 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 | ||