Re: [PATCH -next v2] mm, proc: collect percpu free pages into the free pages

From: Michal Hocko
Date: Mon Nov 27 2023 - 03:50:56 EST


On Fri 24-11-23 18:54:54, Dmytro Maluka wrote:
[...]
> But looking at the code in __alloc_pages() and around, I see you are
> right: we don't try draining other CPUs' PCP lists *before* resorting to
> direct reclaim, compaction etc.
>
> BTW, why not? Shouldn't draining PCP lists be cheaper than pageout() in
> any case?

My guess would be that draining remote pcp caches is quite expensive on
its own. This requires IPIs, preempting whatever is running there and
wait for the all the cpus with pcp caches to be done. On the other hand
reclaiming a mostly clean page cache could be much less expensive.

Also consider that refilling those pcp caches is not free either (you
might hit zone lock contetion and who knows what else).

Last but not least also consider that many systems could be just on the
edge of low/min watermark with a lot of cached data. If we drained all
pcp caches whenever we reclaim this could just make the cache pointless.

All that being said, I do not remember any actual numbers or research
about this.
--
Michal Hocko
SUSE Labs