Prev: [PATCH] Use microsecond granularity for taskstats accounting
Next: [PATCH] vlynq: make whole Kconfig-menu dependant on architecture
From: Andrey Vagin on 14 May 2010 09:40 Signed-off-by: Andrey Vagin <avagin(a)openvz.org> --- include/linux/posix-timers.h | 2 ++ kernel/posix-cpu-timers.c | 13 ++++++++++--- kernel/posix-timers.c | 4 ++++ 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/include/linux/posix-timers.h b/include/linux/posix-timers.h index 4f71bf4..613ab27 100644 --- a/include/linux/posix-timers.h +++ b/include/linux/posix-timers.h @@ -78,6 +78,7 @@ struct k_clock { int (*timer_set) (struct k_itimer * timr, int flags, struct itimerspec * new_setting, struct itimerspec * old_setting); + void (*timer_cleanup) (struct k_itimer * timr); int (*timer_del) (struct k_itimer * timr); #define TIMER_RETRY 1 void (*timer_get) (struct k_itimer * timr, @@ -103,6 +104,7 @@ int posix_cpu_nsleep(const clockid_t which_clock, int flags, long posix_cpu_nsleep_restart(struct restart_block *restart_block); int posix_cpu_timer_set(struct k_itimer *timer, int flags, struct itimerspec *new, struct itimerspec *old); +void posix_cpu_timer_cleanup(struct k_itimer *timer); int posix_cpu_timer_del(struct k_itimer *timer); void posix_cpu_timer_get(struct k_itimer *timer, struct itimerspec *itp); diff --git a/kernel/posix-cpu-timers.c b/kernel/posix-cpu-timers.c index bc7704b..7a57833 100644 --- a/kernel/posix-cpu-timers.c +++ b/kernel/posix-cpu-timers.c @@ -455,14 +455,21 @@ int posix_cpu_timer_del(struct k_itimer *timer) spin_unlock(&p->sighand->siglock); } read_unlock(&tasklist_lock); - - if (!ret) - put_task_struct(p); } + if (!ret) + posix_cpu_timer_cleanup(timer); + return ret; } +void posix_cpu_timer_cleanup(struct k_itimer *timer) +{ + struct task_struct *p = timer->it.cpu.task; + if (likely(p != NULL)) + put_task_struct(p); +} + /* * Clean out CPU timers still ticking when a thread exited. The task * pointer is cleared, and the expiry time is replaced with the residual diff --git a/kernel/posix-timers.c b/kernel/posix-timers.c index 00d1fda..1195668 100644 --- a/kernel/posix-timers.c +++ b/kernel/posix-timers.c @@ -197,6 +197,10 @@ static int common_timer_create(struct k_itimer *new_timer) return 0; } +static inline void common_timer_cleanup(struct k_itimer *timer) +{ +} + static int no_timer_create(struct k_itimer *new_timer) { return -EOPNOTSUPP; -- 1.6.6 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo(a)vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/ |