Re: [PATCH] memcg: decouple memcg_hotplug_cpu_dead from stock_lock

From: Andrew Morton
Date: Fri Apr 11 2025 - 01:06:29 EST


On Thu, 10 Apr 2025 14:06:23 -0700 Shakeel Butt <shakeel.butt@xxxxxxxxx> wrote:

> The function memcg_hotplug_cpu_dead works on the stock of a remote dead
> CPU and drain_obj_stock works on the given stock instead of local stock,
> so there is no need to take local stock_lock anymore.
>
> @@ -1964,10 +1964,10 @@ static int memcg_hotplug_cpu_dead(unsigned int cpu)
>
> stock = &per_cpu(memcg_stock, cpu);
>
> - /* drain_obj_stock requires stock_lock */
> - local_lock_irqsave(&memcg_stock.stock_lock, flags);
> - drain_obj_stock(stock);
> - local_unlock_irqrestore(&memcg_stock.stock_lock, flags);
> + local_irq_save(flag);
> + /* stock of a remote dead cpu, no need for stock_lock. */
> + __drain_obj_stock(stock);
> + local_irq_restore(flag);
>

s/flag/flags/

Obviously what-i-got isn't what-you-tested. Please check what happened
here,