Re: [PATCH v7 2/3] sched/task: Add the put_task_struct_atomic_safe() function

From: Steven Rostedt
Date: Fri May 05 2023 - 10:29:28 EST


On Fri, 5 May 2023 10:26:02 -0400
Steven Rostedt <rostedt@xxxxxxxxxxx> wrote:

> > > IIRC, the in_task() is there because preemptible() doesn't check if it
> > > is running in interrupt context.
> >
> > #define preemptible() (preempt_count() == 0 && !irqs_disabled())
> >
> > When in interrupt context preempt_count() will have a non-zero value in
> > HARDIRQ_MASK and IRQs must be disabled, so preemptible() evaluates to
> > (false && false), last time I checked that ends up being false.
>
> Interesting, I can't find v5 anywhere in my mail folders (but I have
> v4 and v6!). Anyway, from just the context of this email, and seeing
> IS_ENABLED(CONFIG_PREEMPT_RT), I'm guessing that in_task() returns false if
> it's running in a interrupt thread, where preemtible() does not.

But then I question, does it matter if it is running in an interrupt thread
or not for put_task_struct()?

-- Steve