* [PATCH] POSIX timers RCU optimization fix for clock_gettime
@ 2007-02-04 4:15 Paul E. McKenney
0 siblings, 0 replies; only message in thread
From: Paul E. McKenney @ 2007-02-04 4:15 UTC (permalink / raw)
To: linux-kernel; +Cc: oleg, akpm, johnstul, mingo, tglx, zippel
Fixes an exit()/posix_cpu_clock_get() race spotted by Oleg Nesterov.
Solution is to move the p->signal check under the tasklist_lock.
Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
---
posix-cpu-timers.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff -urpNa -X dontdiff linux-2.6.20-rc6-clockrcu/kernel/posix-cpu-timers.c linux-2.6.20-rc6-clockrcu-fixes/kernel/posix-cpu-timers.c
--- linux-2.6.20-rc6-clockrcu/kernel/posix-cpu-timers.c 2007-02-01 13:03:57.000000000 -0800
+++ linux-2.6.20-rc6-clockrcu-fixes/kernel/posix-cpu-timers.c 2007-02-03 16:53:41.000000000 -0800
@@ -312,10 +312,13 @@ int posix_cpu_clock_get(const clockid_t
error = cpu_clock_sample(which_clock,
p, &rtn);
}
- } else if (p->tgid == pid && p->signal) {
+ } else {
read_lock(&tasklist_lock);
- error = cpu_clock_sample_group(which_clock,
- p, &rtn);
+ if (p->tgid == pid && p->signal) {
+ error =
+ cpu_clock_sample_group(which_clock,
+ p, &rtn);
+ }
read_unlock(&tasklist_lock);
}
}
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2007-02-04 4:15 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-02-04 4:15 [PATCH] POSIX timers RCU optimization fix for clock_gettime Paul E. McKenney
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.