All of lore.kernel.org
 help / color / mirror / Atom feed
From: Qian Cai <quic_qiancai@quicinc.com>
To: Jan Kara <jack@suse.cz>
Cc: Theodore Ts'o <tytso@mit.edu>, Jan Kara <jack@suse.com>,
	"Paul E. McKenney" <paulmck@kernel.org>,
	Neeraj Upadhyay <quic_neeraju@quicinc.com>,
	Joel Fernandes <joel@joelfernandes.org>,
	Boqun Feng <boqun.feng@gmail.com>, <linux-ext4@vger.kernel.org>,
	<rcu@vger.kernel.org>, <linux-kernel@vger.kernel.org>
Subject: Re: [RFC PATCH] jbd2: avoid __GFP_ZERO with SLAB_TYPESAFE_BY_RCU
Date: Wed, 9 Feb 2022 13:46:34 -0500	[thread overview]
Message-ID: <YgQMCoEM5/fSZpdo@qian> (raw)
In-Reply-To: <20220209181010.gfn66rvip56i54df@quack3.lan>

On Wed, Feb 09, 2022 at 07:10:10PM +0100, Jan Kara wrote:
> On Wed 09-02-22 11:57:42, Qian Cai wrote:
> > Since the linux-next commit 120aa5e57479 (mm: Check for
> > SLAB_TYPESAFE_BY_RCU and __GFP_ZERO slab allocation), we will get a
> > boot warning. Avoid it by calling synchronize_rcu() before the zeroing.
> > 
> > Signed-off-by: Qian Cai <quic_qiancai@quicinc.com>
> 
> No, the performance impact of this would be just horrible. Can you
> ellaborate a bit why SLAB_TYPESAFE_BY_RCU + __GFP_ZERO is a problem and why
> synchronize_rcu() would be needed here before the memset() please? I mean
> how is zeroing here any different from the memory just being used?

I'll defer to Paul and other RCU developers for more indepth explanations of
the issue with the combo. The above mentioned commit has a bit information:

    Code using a SLAB_TYPESAFE_BY_RCU kmem_cache can have readers accessing
    blocks of memory passed to kmem_cache_free(), and those readers might
    still be accessing those blocks after kmem_cache_alloc() reallocates
    those blocks.  These readers are not going to take kindly to that memory
    being zeroed along the way.  Therefore, add a WARN_ON_ONCE() complaining
    about __GFP_ZERO being passed to an allocation from a SLAB_TYPESAFE_BY_RCU
    kmem_cache.

  reply	other threads:[~2022-02-09 18:52 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-09 16:57 [RFC PATCH] jbd2: avoid __GFP_ZERO with SLAB_TYPESAFE_BY_RCU Qian Cai
2022-02-09 18:10 ` Jan Kara
2022-02-09 18:46   ` Qian Cai [this message]
2022-02-09 20:11   ` Paul E. McKenney
2022-02-10  5:07     ` Theodore Ts'o
2022-02-10  5:43       ` Paul E. McKenney
2022-02-10 15:54         ` Theodore Ts'o
2022-02-10  9:16     ` Jan Kara
2022-02-10 14:57       ` Paul E. McKenney
2022-02-10 19:12         ` Jan Kara
2022-02-10 20:06           ` Paul E. McKenney
2022-02-10 20:08             ` Paul E. McKenney

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=YgQMCoEM5/fSZpdo@qian \
    --to=quic_qiancai@quicinc.com \
    --cc=boqun.feng@gmail.com \
    --cc=jack@suse.com \
    --cc=jack@suse.cz \
    --cc=joel@joelfernandes.org \
    --cc=linux-ext4@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=paulmck@kernel.org \
    --cc=quic_neeraju@quicinc.com \
    --cc=rcu@vger.kernel.org \
    --cc=tytso@mit.edu \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.