Re: [PATCH] mm, slub: add cpus_read_lock/unlock() for slab_mem_going_offline_callback()

From: Vlastimil Babka
Date: Tue Aug 17 2021 - 03:57:52 EST


On 8/16/21 10:04 AM, David Hildenbrand wrote:
> On 16.08.21 09:46, qiang.zhang@xxxxxxxxxxxxx wrote:
>> From: "Qiang.Zhang" <qiang.zhang@xxxxxxxxxxxxx>
>>
>> The flush_all_cpus_locked() should be called with cpus_read_lock/unlock(),
>> ensure flush_cpu_slab() can be executed on schedule_on CPU.
>>
>> Fixes: 1c84f3c91640 ("mm, slub: fix memory and cpu hotplug related lock ordering issues")
> Memory notifiers are getting called from online_pages()/offline_pages(),
> where we call memory_notify(MEM_GOING_OFFLINE, &arg) under
> mem_hotplug_begin().
>
> mem_hotplug_begin() does a cpus_read_lock().

Exactly. Also flush_all_cpus_locked() has a lockdep assert for
cpus_read_lock() which doesn't trigger in testing.

> How does this even work or against which branch is this?
>