Re: [PATCH] mm: memcg: flush empty per-cpu stock slots on memcg offlining

From: Song Hu

Date: Mon Aug 17 2026 - 09:14:22 EST


On Mon 17-08-26, Michal Hocko wrote:
> Is there any specific reason why the memcg stays in the cache slot
> without any pages?

consume_stock() doesn't release the slot when nr_pages hits zero. It
is kept for the next charge of the same task and only gets displaced
by a charge under a different memcg or by CPU hotplug. The problem is
that the offlining drain skips empty slots, so the css reference they
hold is never dropped unless something unrelated displaces them.