From: "Paul E. McKenney" <paulmck@kernel.org>
To: Vlastimil Babka <vbabka@suse.cz>
Cc: David Rientjes <rientjes@google.com>,
Andrew Morton <akpm@linux-foundation.org>,
Christoph Lameter <cl@linux.com>,
Pekka Enberg <penberg@kernel.org>,
Joonsoo Kim <iamjoonsoo.kim@lge.com>,
linux-mm@kvack.org, linux-kernel@vger.kernel.org,
linux-btrfs@vger.kernel.org, David Sterba <dsterba@suse.com>,
Oliver Glitta <glittao@gmail.com>
Subject: Re: [PATCH] [PATCH] mm, slub: enable slub_debug static key when creating cache with explicit debug flags
Date: Mon, 15 Mar 2021 10:59:32 -0700 [thread overview]
Message-ID: <20210315175932.GO2696@paulmck-ThinkPad-P72> (raw)
In-Reply-To: <8c4f3385-e935-8363-c6bd-ffe6b8c2d6c4@suse.cz>
On Mon, Mar 15, 2021 at 06:36:34PM +0100, Vlastimil Babka wrote:
> On 3/15/21 6:32 PM, Paul E. McKenney wrote:
> > On Mon, Mar 15, 2021 at 06:28:42PM +0100, Vlastimil Babka wrote:
> >> On 3/15/21 6:16 PM, David Rientjes wrote:
> >> > On Mon, 15 Mar 2021, Vlastimil Babka wrote:
> >> >
> >> >> Commit ca0cab65ea2b ("mm, slub: introduce static key for slub_debug()")
> >> >> introduced a static key to optimize the case where no debugging is enabled for
> >> >> any cache. The static key is enabled when slub_debug boot parameter is passed,
> >> >> or CONFIG_SLUB_DEBUG_ON enabled.
> >> >>
> >> >> However, some caches might be created with one or more debugging flags
> >> >> explicitly passed to kmem_cache_create(), and the commit missed this. Thus the
> >> >> debugging functionality would not be actually performed for these caches unless
> >> >> the static key gets enabled by boot param or config.
> >> >>
> >> >> This patch fixes it by checking for debugging flags passed to
> >> >> kmem_cache_create() and enabling the static key accordingly.
> >> >>
> >> >> Note such explicit debugging flags should not be used outside of debugging and
> >> >> testing as they will now enable the static key globally. btrfs_init_cachep()
> >> >> creates a cache with SLAB_RED_ZONE but that's a mistake that's being corrected
> >> >> [1]. rcu_torture_stats() creates a cache with SLAB_STORE_USER, but that is a
> >> >> testing module so it's OK and will start working as intended after this patch.
> >> >>
> >> >> Also note that in case of backports to kernels before v5.12 that don't have
> >> >> 59450bbc12be ("mm, slab, slub: stop taking cpu hotplug lock"),
> >> >> static_branch_enable_cpuslocked() should be used.
> >> >>
> >> >
> >> > Since this affects 5.9+, is the plan to propose backports to stable with
> >> > static_branch_enable_cpuslocked() once this is merged? (I notice the
> >> > absence of the stable tag here, which I believe is intended.)
> >>
> >> I was thinking about it, and since the rcutorture user is only in -next (AFAICS)
> >> and btrfs user was unintended, it didn't seem to meet stable criteria to me. But
> >> I won't mind if it's backported.
> >
> > I had better ask... Should rcutorture be doing something different?
> >
> > Thanx, Paul
>
> No, I think it's fine if a testing module such as rcutorture flips the static
> key for the rest of the kernel's uptime. I only CC'd you as FYI in case you were
> wondering why you can't see any alloc/free stacks in its output :)
Ah, all of my recent tests have been for sufficient duration that all
was well by the time that that code was invoked. But thank you for the
heads up -- someone will hit this sooner or later, and I freely confess
that I would have been clueless.
Thanx, Paul
prev parent reply other threads:[~2021-03-15 18:38 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-15 15:34 Vlastimil Babka
2021-03-15 17:16 ` David Rientjes
2021-03-15 17:28 ` Vlastimil Babka
2021-03-15 17:32 ` Paul E. McKenney
2021-03-15 17:36 ` Vlastimil Babka
2021-03-15 17:59 ` Paul E. McKenney [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=20210315175932.GO2696@paulmck-ThinkPad-P72 \
--to=paulmck@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=cl@linux.com \
--cc=dsterba@suse.com \
--cc=glittao@gmail.com \
--cc=iamjoonsoo.kim@lge.com \
--cc=linux-btrfs@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=penberg@kernel.org \
--cc=rientjes@google.com \
--cc=vbabka@suse.cz \
/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