]> err.no Git - linux-2.6/commitdiff
[PATCH] posix-timers: fix task accounting
authorOleg Nesterov <oleg@tv-sign.ru>
Mon, 17 Oct 2005 14:49:42 +0000 (18:49 +0400)
committerLinus Torvalds <torvalds@g5.osdl.org>
Mon, 17 Oct 2005 22:00:00 +0000 (15:00 -0700)
Make sure we release the task struct properly when releasing pending
timers.

release_task() does write_lock_irq(&tasklist_lock), so it can't race
with run_posix_cpu_timers() on any cpu.

Signed-off-by: Oleg Nesterov <oleg@tv-sign.ru>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
kernel/posix-cpu-timers.c

index ad85d3f0dcc45bdff09e6f50060881e810eba722..7a51a5597c33e04ad5f3f86d121779189ca326b3 100644 (file)
@@ -424,6 +424,7 @@ static void cleanup_timers(struct list_head *head,
        cputime_t ptime = cputime_add(utime, stime);
 
        list_for_each_entry_safe(timer, next, head, entry) {
+               put_task_struct(timer->task);
                timer->task = NULL;
                list_del_init(&timer->entry);
                if (cputime_lt(timer->expires.cpu, ptime)) {
@@ -436,6 +437,7 @@ static void cleanup_timers(struct list_head *head,
 
        ++head;
        list_for_each_entry_safe(timer, next, head, entry) {
+               put_task_struct(timer->task);
                timer->task = NULL;
                list_del_init(&timer->entry);
                if (cputime_lt(timer->expires.cpu, utime)) {
@@ -448,6 +450,7 @@ static void cleanup_timers(struct list_head *head,
 
        ++head;
        list_for_each_entry_safe(timer, next, head, entry) {
+               put_task_struct(timer->task);
                timer->task = NULL;
                list_del_init(&timer->entry);
                if (timer->expires.sched < sched_time) {