lkml.org 
[lkml]   [2009]   [Jun]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[PATCH 2/2] posix-cpu-timers: remove tasklist_lock where we can
tasklist_lock is not needed to protect find_task_by_vpid() nor
thread_group_leader() nor same_thread_group() , use rcu_read_lock() instead.

Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
---
kernel/posix-cpu-timers.c | 8 ++++----
1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/kernel/posix-cpu-timers.c b/kernel/posix-cpu-timers.c
index bece7c0..1d9cdf3 100644
--- a/kernel/posix-cpu-timers.c
+++ b/kernel/posix-cpu-timers.c
@@ -37,13 +37,13 @@ static int check_clock(const clockid_t which_clock)
if (pid == 0)
return 0;

- read_lock(&tasklist_lock);
+ rcu_read_lock();
p = find_task_by_vpid(pid);
if (!p || !(CPUCLOCK_PERTHREAD(which_clock) ?
same_thread_group(p, current) : thread_group_leader(p))) {
error = -EINVAL;
}
- read_unlock(&tasklist_lock);
+ rcu_read_lock();

return error;
}
@@ -398,7 +398,7 @@ int posix_cpu_timer_create(struct k_itimer *new_timer)
new_timer->it.cpu.incr.sched = 0;
new_timer->it.cpu.expires.sched = 0;

- read_lock(&tasklist_lock);
+ rcu_read_lock();
if (CPUCLOCK_PERTHREAD(new_timer->it_clock)) {
if (pid == 0) {
p = current;
@@ -422,7 +422,7 @@ int posix_cpu_timer_create(struct k_itimer *new_timer)
} else {
ret = -EINVAL;
}
- read_unlock(&tasklist_lock);
+ rcu_read_unlock();

return ret;
}
--
1.6.0.6


\
 
 \ /
  Last update: 2009-06-12 08:59    [W:0.046 / U:0.072 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site