[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAGj-7pUxYUDdRGaiFon=V2EG+3Ex5s9i7VvWbDH5T0v-7SE-CQ@mail.gmail.com>
Date: Fri, 11 Apr 2025 13:54:37 -0400
From: Shakeel Butt <shakeel.butt@...il.com>
To: Vlastimil Babka <vbabka@...e.cz>, Sebastian Andrzej Siewior <bigeasy@...utronix.de>
Cc: Shakeel Butt <shakeel.butt@...ux.dev>, Andrew Morton <akpm@...ux-foundation.org>,
Johannes Weiner <hannes@...xchg.org>, Michal Hocko <mhocko@...nel.org>,
Roman Gushchin <roman.gushchin@...ux.dev>, Muchun Song <muchun.song@...ux.dev>,
Yosry Ahmed <yosry.ahmed@...ux.dev>, Waiman Long <llong@...hat.com>, linux-mm@...ck.org,
cgroups@...r.kernel.org, linux-kernel@...r.kernel.org,
Meta kernel team <kernel-team@...a.com>
Subject: Re: [PATCH] memcg: decouple memcg_hotplug_cpu_dead from stock_lock
(my migadu/linux.dev stopped working and I have to send through gmail,
sorry for any formatting issue)
On Fri, Apr 11, 2025 at 04:06:46PM +0200, Sebastian Andrzej Siewior wrote:
>
> On 2025-04-11 10:55:31 [+0200], Vlastimil Babka wrote:
>
> > @@ -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);
>
> I think for RT this is not great?
>
This is not a performance critical function, so I would not worry about
that.
>
> At least in theory, probably it's not
>
> actually used together with cpu hotplug? As it relies on memcg_stats_lock()
>
> I think no irq save/enable is necessary there. local_lock_irqsave wasn't
>
> actually a irq disable on RT. I don't know if there's a handy wrapper for this.
>
> No seeing the whole context but memcg_hotplug_cpu_dead() should be
>
> invoked the control CPU while "cpu" is already gone. So the local_lock
>
> should be acquired and the target CPU needs no locks since it is
>
> offline. local_irq_save() will break things.
>
I don't see how local_irq_save() will break anything. We are working on
a stock of a dead remote cpu. We actually don't even need to disable irq
or need local cpu's local_lock. It is actually the calls to
__mod_memcg_lruvec_state() and __mod_memcg_state() in
__drain_obj_stock() which need irq-disabled on non-RT kernels and for
RT-kernels they already have preempt_disable_nested().
Disabling irq even on RT seems excessive but this is not a performance
critical code, so I don't see an issue unless there is
local_lock_irqsave() alternative which does not disables irqs on RT
kernels.
Powered by blists - more mailing lists