aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/taskstats.c
diff options
context:
space:
mode:
authorChen Gang <gang.chen@asianux.com>2013-11-12 18:11:23 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2013-11-12 22:09:34 -0500
commit0d20633b041041ecda39ae562e62087acf0092f1 (patch)
treefdc3283c0a96c22705c103b04a87567029a9c4a8 /kernel/taskstats.c
parent3fa582663129330d57d15b97ae534dc1203fc3aa (diff)
kernel/taskstats.c: return -ENOMEM when alloc memory fails in add_del_listener()
For registering in add_del_listener(), when kmalloc_node() fails, need return -ENOMEM instead of success code, and cmd_attr_register_cpumask() wants to know about it. After modification, give a simple common test "build -> boot up -> kernel/controllers/cgroup/getdelays by LTP tools". Signed-off-by: Chen Gang <gang.chen@asianux.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'kernel/taskstats.c')
-rw-r--r--kernel/taskstats.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/kernel/taskstats.c b/kernel/taskstats.c
index 1db6808c494b..9f4618eb51c8 100644
--- a/kernel/taskstats.c
+++ b/kernel/taskstats.c
@@ -290,6 +290,7 @@ static int add_del_listener(pid_t pid, const struct cpumask *mask, int isadd)
290 struct listener_list *listeners; 290 struct listener_list *listeners;
291 struct listener *s, *tmp, *s2; 291 struct listener *s, *tmp, *s2;
292 unsigned int cpu; 292 unsigned int cpu;
293 int ret = 0;
293 294
294 if (!cpumask_subset(mask, cpu_possible_mask)) 295 if (!cpumask_subset(mask, cpu_possible_mask))
295 return -EINVAL; 296 return -EINVAL;
@@ -304,9 +305,10 @@ static int add_del_listener(pid_t pid, const struct cpumask *mask, int isadd)
304 for_each_cpu(cpu, mask) { 305 for_each_cpu(cpu, mask) {
305 s = kmalloc_node(sizeof(struct listener), 306 s = kmalloc_node(sizeof(struct listener),
306 GFP_KERNEL, cpu_to_node(cpu)); 307 GFP_KERNEL, cpu_to_node(cpu));
307 if (!s) 308 if (!s) {
309 ret = -ENOMEM;
308 goto cleanup; 310 goto cleanup;
309 311 }
310 s->pid = pid; 312 s->pid = pid;
311 s->valid = 1; 313 s->valid = 1;
312 314
@@ -339,7 +341,7 @@ cleanup:
339 } 341 }
340 up_write(&listeners->sem); 342 up_write(&listeners->sem);
341 } 343 }
342 return 0; 344 return ret;
343} 345}
344 346
345static int parse(struct nlattr *na, struct cpumask *mask) 347static int parse(struct nlattr *na, struct cpumask *mask)