Re: [patch V2 8/8] posix-timers: Handle exit in do_exit() completely
From: Oleg Nesterov
Date: Sun Sep 06 2026 - 12:44:47 EST
I am still trying to understand this patch, one question for now.
On 09/05, Thomas Gleixner wrote:
>
> +void posix_cpu_timers_exit_task(void)
> {
> - cleanup_timers(&tsk->posix_cputimers);
> + posix_cpu_timers_exit_work();
> +
> + guard(spinlock_irq)(¤t->sighand->siglock);
> + cleanup_timers(¤t->posix_cputimers);
> }
So it calls posix_cpu_timers_exit_work()
> +static inline void posix_cpu_timers_exit_work(void)
> +{
> + /*
> + * current->flags has PF_EXITING set so this can be done lockless and
> + * with interrupts enabled as PF_EXITING prevents the interrupt from
> + * scheduling the work.
> + */
> + if (current->posix_cputimers_work.scheduled)
> + task_work_cancel(current, ¤t->posix_cputimers_work.work);
... which does not clear ->scheduled
> void posixtimer_exec(void)
> {
> - scoped_guard(spinlock_irq, ¤t->sighand->siglock)
> - posix_cpu_timers_exit(current);
> -
> + posix_cpu_timers_exit_task();
... and this looks obviously wrong for posixtimer_exec() ?
Oleg.