lkml.org 
[lkml]   [2021]   [Jul]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
SubjectRe: [rfc/patch] mm/slub: restore/expand unfreeze_partials() local exclusion scope
From
Date
On Wed, 2021-07-21 at 10:44 +0200, Vlastimil Babka wrote:
>
> So this doesn't look like our put_cpu_partial() preempted a
> __slab_alloc() on the same cpu, right?

No, likely it was the one preempted by someone long gone, but we'll
never know without setting a trap.

> BTW did my ugly patch work?

Nope. I guess you missed my reporting it to have been a -ENOBOOT, and
that cutting it in half, ie snagging only __slab_free() does boot, and
seems to cure all of the RT fireworks.

(chainsaw noises...)

---
mm/slub.c | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)

--- a/mm/slub.c
+++ b/mm/slub.c
@@ -2551,6 +2551,8 @@ static void put_cpu_partial(struct kmem_
int pobjects;

slub_get_cpu_ptr(s->cpu_slab);
+ if (IS_ENABLED(CONFIG_PREEMPT_RT) && drain)
+ local_lock(&s->cpu_slab->lock);
do {
pages = 0;
pobjects = 0;
@@ -2564,7 +2566,13 @@ static void put_cpu_partial(struct kmem_
* partial array is full. Move the existing
* set to the per node partial list.
*/
- unfreeze_partials(s);
+ this_cpu_write(s->cpu_slab->partial, NULL);
+ if (IS_ENABLED(CONFIG_PREEMPT_RT) && drain)
+ local_unlock(&s->cpu_slab->lock);
+ __unfreeze_partials(s, oldpage);
+ if (IS_ENABLED(CONFIG_PREEMPT_RT) && drain)
+ local_lock(&s->cpu_slab->lock);
+
oldpage = NULL;
pobjects = 0;
pages = 0;
@@ -2581,6 +2589,8 @@ static void put_cpu_partial(struct kmem_

} while (this_cpu_cmpxchg(s->cpu_slab->partial, oldpage, page)
!= oldpage);
+ if (IS_ENABLED(CONFIG_PREEMPT_RT) && drain)
+ local_unlock(&s->cpu_slab->lock);
slub_put_cpu_ptr(s->cpu_slab);
#endif /* CONFIG_SLUB_CPU_PARTIAL */
}

\
 
 \ /
  Last update: 2021-07-21 11:42    [W:0.111 / U:0.336 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site