Re: Is it possible to implement the per-node page cache for programs/libraries?

From: Linus Torvalds
Date: Wed Sep 01 2021 - 13:29:23 EST


On Wed, Sep 1, 2021 at 10:24 AM Linus Torvalds
<torvalds@xxxxxxxxxxxxxxxxxxxx> wrote:
>
> But what you could do, if you wanted to, would be to catch the
> situation where you have lots of expensive NUMA accesses either using
> our VM infrastructure or performance counters, and when the mapping is
> a MAP_PRIVATE you just do a COW fault on them.
>
> Sounds entirely doable, and has absolutely nothing to do with the page
> cache. It would literally just be an "over-eager COW fault triggered
> by NUMA access counters".

Note how it would work perfectly fine for anonymous mappings too. Just
to reinforce the point that this has nothing to do with any page cache
issues.

Of course, if you want to actually then *share* pages within a node
(rather than replicate them for each process), that gets more
exciting.

But I suspect that this is mainly only useful for long-running big
processes (not least due to that node binding thing), so I question
the need for that kind of excitement.

Linus