Re: [rfc/patch] mm/slub: restore/expand unfreeze_partials() local exclusion scope

From: Mike Galbraith
Date: Thu Jul 29 2021 - 00:52:00 EST


On Wed, 2021-07-28 at 18:59 +0200, Vlastimil Babka wrote:
> On 7/27/21 6:09 AM, Mike Galbraith wrote:
> > On Mon, 2021-07-26 at 23:26 +0200, Vlastimil Babka wrote:
> > > On 7/26/21 7:00 PM, Mike Galbraith wrote:
> > > >
> > > > Why not do something like the below?...
> > >
> > > Yep, sounds like a good approach, thanks. Percpu partial is not *the*
> > > SLUB fast path, so it should be sufficient without the lockless cmpxchg
> > > tricks. Will incorporate in updated series.
>
> The updated series incorporating hopefully all fixes from Mike and
> bigeasy, and rebased to 5.14-rc3 (Thomas told me RT is moving to it), is
> here:
>
> https://git.kernel.org/pub/scm/linux/kernel/git/vbabka/linux.git/log/?h=slub-local-lock-v3r0

I had to resurrect the hunk below to build with lockdep, but modulo
dinky speedbump, the same RT testdrive that previously exploded was as
entertainment free as such testing is supposed to be.

---
mm/slub.c | 4 ++++
1 file changed, 4 insertions(+)

--- a/mm/slub.c
+++ b/mm/slub.c
@@ -2890,7 +2890,11 @@ static void *___slab_alloc(struct kmem_c

load_freelist:

+#ifdef CONFIG_PREEMPT_RT
+ lockdep_assert_held(this_cpu_ptr(&s->cpu_slab->lock.lock));
+#else
lockdep_assert_held(this_cpu_ptr(&s->cpu_slab->lock));
+#endif

/*
* freelist is pointing to the list of objects to be used.