From e14929c6989db22f3eeaef4e343f050bb156e2cd Mon Sep 17 00:00:00 2001 From: Thomas Gleixner Date: Wed, 9 Dec 2009 10:15:01 +0000 Subject: [PATCH] --- yaml --- r: 178021 b: refs/heads/master c: 23f5d142519621b16cf2b378cf8adf4dcf01a616 h: refs/heads/master i: 178019: acbbd1fac45b5962a7274b6e35077b531205a290 v: v3 --- [refs] | 2 +- trunk/kernel/sched.c | 16 ++++++---------- 2 files changed, 7 insertions(+), 11 deletions(-) diff --git a/[refs] b/[refs] index 1aea31191fe5..476fb54c5493 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 5fe85be081edf0ac92d83f9c39e0ab5c1371eb82 +refs/heads/master: 23f5d142519621b16cf2b378cf8adf4dcf01a616 diff --git a/trunk/kernel/sched.c b/trunk/kernel/sched.c index 1782beed2fa7..79893123325c 100644 --- a/trunk/kernel/sched.c +++ b/trunk/kernel/sched.c @@ -6516,22 +6516,18 @@ long sched_setaffinity(pid_t pid, const struct cpumask *in_mask) int retval; get_online_cpus(); - read_lock(&tasklist_lock); + rcu_read_lock(); p = find_process_by_pid(pid); if (!p) { - read_unlock(&tasklist_lock); + rcu_read_unlock(); put_online_cpus(); return -ESRCH; } - /* - * It is not safe to call set_cpus_allowed with the - * tasklist_lock held. We will bump the task_struct's - * usage count and then drop tasklist_lock. - */ + /* Prevent p going away */ get_task_struct(p); - read_unlock(&tasklist_lock); + rcu_read_unlock(); if (!alloc_cpumask_var(&cpus_allowed, GFP_KERNEL)) { retval = -ENOMEM; @@ -6617,7 +6613,7 @@ long sched_getaffinity(pid_t pid, struct cpumask *mask) int retval; get_online_cpus(); - read_lock(&tasklist_lock); + rcu_read_lock(); retval = -ESRCH; p = find_process_by_pid(pid); @@ -6633,7 +6629,7 @@ long sched_getaffinity(pid_t pid, struct cpumask *mask) task_rq_unlock(rq, &flags); out_unlock: - read_unlock(&tasklist_lock); + rcu_read_unlock(); put_online_cpus(); return retval;