On Mon, Jun 27, 2022 at 09:48:01AM -0700, Shakeel Butt wrote: > On Mon, Jun 27, 2022 at 9:26 AM Eric Dumazet <edumazet@xxxxxxxxxx> wrote: > > > [...] > > > > > > > I simply did the following and got much better results. > > > > But I am not sure if updates to ->usage are really needed that often... > > I suspect we need to improve the per-cpu memcg stock usage here. Were > the updates mostly from uncharge path or charge path or that's > irrelevant? > > I think doing full drain (i.e. drain_stock()) within __refill_stock() > when the local cache is larger than MEMCG_CHARGE_BATCH is not best. > Rather we should always keep at least MEMCG_CHARGE_BATCH for such > scenarios. +1, really good point.