[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YgQMCoEM5/fSZpdo@qian>
Date: Wed, 9 Feb 2022 13:46:34 -0500
From: Qian Cai <quic_qiancai@...cinc.com>
To: Jan Kara <jack@...e.cz>
CC: Theodore Ts'o <tytso@....edu>, Jan Kara <jack@...e.com>,
"Paul E. McKenney" <paulmck@...nel.org>,
Neeraj Upadhyay <quic_neeraju@...cinc.com>,
Joel Fernandes <joel@...lfernandes.org>,
Boqun Feng <boqun.feng@...il.com>,
<linux-ext4@...r.kernel.org>, <rcu@...r.kernel.org>,
<linux-kernel@...r.kernel.org>
Subject: Re: [RFC PATCH] jbd2: avoid __GFP_ZERO with SLAB_TYPESAFE_BY_RCU
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@...cinc.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.
Powered by blists - more mailing lists