Re: [PATCH] mm: madvise: fix uneven accounting of psi

From: Charan Teja Kalla
Date: Mon Jun 26 2023 - 10:31:46 EST


Hi Suren,

On 6/10/2023 4:43 AM, Suren Baghdasaryan wrote:
>>> I can see use for that from userspace to detect incorrect madvise()
>>> and adjust its aggressiveness. I think the API might get a bit complex
>>> because of the need to associate refaults with specific madvise()/VMAs
>>> to understand which hint was incorrect and adjust the behavior.
>>> Instead what is the opinion about giving an MADV_PAGEOUT_INACTIVE
>> interface which does operate on a page only If it is on the inactive
>> list and !PageWorkingset ?
> IOW you want a less aggressive mechanism which can be used by the
> userspace to tell the kernel "I think these pages won't be used but
> I'm not 100% sure, so drop them only if they are inactive"?
> I don't know how much that will help when the madvise() ends up being
> wrong but maybe you can quickly experiment and tell us if the
> difference is substantial?

We did some extensive testing on Android and this ask is not helping us
much. I am really not sure if there is some other usecase that can
benefit from this. So, for now I just stick to your suggestion of making
the pages on the Active list as the Workingset at the time of pageout.
>

Thanks.