From: Oleg Nesterov <oleg@redhat.com>
To: Wander Lairson Costa <wander@redhat.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
Thomas Gleixner <tglx@linutronix.de>,
"Eric W. Biederman" <ebiederm@xmission.com>,
Andy Lutomirski <luto@kernel.org>,
Sebastian Andrzej Siewior <bigeasy@linutronix.de>,
Peter Zijlstra <peterz@infradead.org>,
"Liam R. Howlett" <Liam.Howlett@oracle.com>,
Fenghua Yu <fenghua.yu@intel.com>,
Andrei Vagin <avagin@gmail.com>,
open list <linux-kernel@vger.kernel.org>,
Hu Chunyu <chuhu@redhat.com>,
Valentin Schneider <vschneid@redhat.com>,
Paul McKenney <paulmck@kernel.org>
Subject: Re: [PATCH v3] kernel/fork: beware of __put_task_struct calling context
Date: Thu, 2 Feb 2023 21:22:46 +0100 [thread overview]
Message-ID: <20230202202245.GB17563@redhat.com> (raw)
In-Reply-To: <CAAq0SUmYbpTnVBe+FEn+wQjLsfaAv-uxP0QuNEpSh8iaxAD+1g@mail.gmail.com>
On 02/02, Wander Lairson Costa wrote:
>
> > We already have delayed_put_task_struct() which differs very much.
> > Perhaps something like ___put_task_struct() will look less confusing.
> >
>
> ___put_task_struct()? I already added a function with this name below.
Ah, I meant ___put_task_struct_rcu() or something like this. Bug again
this is just cosmetic nit, please ignore
> > > +void __put_task_struct(struct task_struct *tsk)
> > > +{
> > > + if (IS_ENABLED(CONFIG_PREEMPT_RT) && (!preemptible() || !in_task()))
> > > + /*
> > > + * under PREEMPT_RT, we can't call put_task_struct
> > > + * in atomic context because it will indirectly
> > > + * acquire sleeping locks.
> > > + */
> > > + call_rcu(&tsk->rcu, __delayed_put_task_struct);
> >
> > Perhaps this deserves additional note to explain why is it safe to use tsk->rcu
> > union. May be this is obvious, but I was confused when I looked at the previous
> > version ;)
> >
>
> Makes sense, I will add it in the next version.
Thanks ;)
Oleg.
prev parent reply other threads:[~2023-02-02 20:24 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-01 12:45 [PATCH v3] kernel/fork: beware of __put_task_struct calling context Wander Lairson Costa
2023-02-02 18:37 ` Oleg Nesterov
2023-02-02 19:55 ` Wander Lairson Costa
2023-02-02 20:22 ` Oleg Nesterov [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230202202245.GB17563@redhat.com \
--to=oleg@redhat.com \
--cc=Liam.Howlett@oracle.com \
--cc=akpm@linux-foundation.org \
--cc=avagin@gmail.com \
--cc=bigeasy@linutronix.de \
--cc=chuhu@redhat.com \
--cc=ebiederm@xmission.com \
--cc=fenghua.yu@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=luto@kernel.org \
--cc=paulmck@kernel.org \
--cc=peterz@infradead.org \
--cc=tglx@linutronix.de \
--cc=vschneid@redhat.com \
--cc=wander@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox