Re: [RFC 11/26] mm, slub: move disabling irqs closer to get_partial() in ___slab_alloc()

From: Jann Horn
Date: Tue May 25 2021 - 12:00:53 EST


On Tue, May 25, 2021 at 1:40 AM Vlastimil Babka <vbabka@xxxxxxx> wrote:
> Continue reducing the irq disabled scope. Check for per-cpu partial slabs with
> first with irqs enabled and then recheck with irqs disabled before grabbing
> the slab page. Mostly preparatory for the following patches.
[...]
> diff --git a/mm/slub.c b/mm/slub.c
[...]
> if (slub_percpu_partial(c)) {
> + local_irq_save(flags);
> + if (unlikely(c->page)) {
> + local_irq_restore(flags);
> + goto reread_page;
> + }
> + if (unlikely(!slub_percpu_partial(c))) /* stolen by IRQ? */
> + goto new_objects;

nit: I think this comment is wrong by the end of the patch series,
since at that point, in RT configurations, it could also be stolen by
another task, if I understand correctly what migrate_disable() means?

Similarly the comment above ___slab_alloc() still talks about
disabling preemption for bulk allocation.