From: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
To: Oleg Nesterov <oleg@redhat.com>
Cc: Wander Lairson Costa <wander@redhat.com>,
Andrew Morton <akpm@linux-foundation.org>,
Thomas Gleixner <tglx@linutronix.de>,
"Eric W. Biederman" <ebiederm@xmission.com>,
Andy Lutomirski <luto@kernel.org>,
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 v4] kernel/fork: beware of __put_task_struct calling context
Date: Fri, 10 Feb 2023 17:48:39 +0100 [thread overview]
Message-ID: <Y+Z1Z85htbmMtsmH@linutronix.de> (raw)
In-Reply-To: <20230206162758.GB1487@redhat.com>
On 2023-02-06 17:27:58 [+0100], Oleg Nesterov wrote:
> On 02/06, Sebastian Andrzej Siewior wrote:
> >
> > On 2023-02-06 16:27:12 [+0100], Oleg Nesterov wrote:
> >
> > > > If so why not use it
> > > > unconditionally?
> > >
> > > performance ?
> >
> > All the free() part is moved from the caller into rcu.
>
> sorry, I don't understand,
That callback does mostly free() and it is batched with other free()
invocations. This also is moved away from the caller which _might_
benefit.
> > > And... I still don't like the name of delayed_put_task_struct_rcu() to me
> > > ___put_task_struct_rcu() looks a bit less confusing, note that we already
> > > have delayed_put_task_struct(). But this is minor.
> >
> > So if we do it unconditionally then we could get rid of
> > put_task_struct_rcu_user().
>
> Yes. But the whole purpose of rcu_users is that we want to avoid the unconditional
> rcu grace period before free_task() ?
Oh, this is usage vs rcu_users. Okay, mixed that up.
> Just in case... please note that delayed_put_task_struct() delays
> refcount_sub(t->usage), not free_task().
Just noticed ;)
> Why do we need this? Consider
>
> rcu_read_lock();
>
> task = find-task-in-rcu-protected-list;
>
> // Safe, task->usage can't be zero
> get_task_struct(task);
>
> rcu_read_unlock();
>
>
> > Otherwise we could use put_task_struct_rcu_user() in that timer
> > callback because it will lead to lockdep warnings once printk is fixed.
>
> IIUC there are more in-atomic callers of put_task_struct(). But perhaps
> I misunderstood you...
That is true. So you are saying that we don't what to use RCU for
put_task_struct() unconditionally?
> Oleg.
Sebastian
next prev parent reply other threads:[~2023-02-10 16:48 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-06 13:04 [PATCH v4] kernel/fork: beware of __put_task_struct calling context Wander Lairson Costa
2023-02-06 14:56 ` Sebastian Andrzej Siewior
2023-02-06 15:27 ` Oleg Nesterov
2023-02-06 16:04 ` Sebastian Andrzej Siewior
2023-02-06 16:27 ` Oleg Nesterov
2023-02-10 16:48 ` Sebastian Andrzej Siewior [this message]
2023-02-06 18:36 ` Wander Lairson Costa
2023-02-06 18:34 ` Wander Lairson Costa
2023-02-06 18:32 ` Wander Lairson Costa
2023-02-07 1:09 ` Andrew Morton
2023-02-07 15:26 ` Wander Lairson Costa
2023-02-10 17:08 ` Sebastian Andrzej Siewior
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=Y+Z1Z85htbmMtsmH@linutronix.de \
--to=bigeasy@linutronix.de \
--cc=Liam.Howlett@oracle.com \
--cc=akpm@linux-foundation.org \
--cc=avagin@gmail.com \
--cc=chuhu@redhat.com \
--cc=ebiederm@xmission.com \
--cc=fenghua.yu@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=luto@kernel.org \
--cc=oleg@redhat.com \
--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