Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 254108
b: refs/heads/master
c: 26c4cae
h: refs/heads/master
v: v3
  • Loading branch information
Vasiliy Kulikov authored and Linus Torvalds committed Jun 28, 2011
1 parent f495268 commit a5e6565
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 08142579b6ca35883c1ed066a2681de6f6917062
refs/heads/master: 26c4caea9d697043cc5a458b96411b86d7f6babd
15 changes: 12 additions & 3 deletions trunk/kernel/taskstats.c
Original file line number Diff line number Diff line change
Expand Up @@ -285,16 +285,18 @@ static void fill_tgid_exit(struct task_struct *tsk)
static int add_del_listener(pid_t pid, const struct cpumask *mask, int isadd)
{
struct listener_list *listeners;
struct listener *s, *tmp;
struct listener *s, *tmp, *s2;
unsigned int cpu;

if (!cpumask_subset(mask, cpu_possible_mask))
return -EINVAL;

s = NULL;
if (isadd == REGISTER) {
for_each_cpu(cpu, mask) {
s = kmalloc_node(sizeof(struct listener), GFP_KERNEL,
cpu_to_node(cpu));
if (!s)
s = kmalloc_node(sizeof(struct listener),
GFP_KERNEL, cpu_to_node(cpu));
if (!s)
goto cleanup;
s->pid = pid;
Expand All @@ -303,9 +305,16 @@ static int add_del_listener(pid_t pid, const struct cpumask *mask, int isadd)

listeners = &per_cpu(listener_array, cpu);
down_write(&listeners->sem);
list_for_each_entry_safe(s2, tmp, &listeners->list, list) {
if (s2->pid == pid)
goto next_cpu;
}
list_add(&s->list, &listeners->list);
s = NULL;
next_cpu:
up_write(&listeners->sem);
}
kfree(s);
return 0;
}

Expand Down

0 comments on commit a5e6565

Please sign in to comment.