On Fri, 24 Jan 2020 17:40:51 +0100 Alexander Graf wrote: > > On 24.01.20 14:23, Hillf Danton wrote: > > > > On Thu, 23 Jan 2020 11:20:07 +0100 Alexander Graf wrote: > >> > >> The big problem I see is that what I really want from a user's point of > >> view is a tuneable that says "Automatically free clean page cache pages > >> that were not accessed in the last X minutes". > > > > A diff is made on top of 1a4e58cce84e ("mm: introduce MADV_PAGEOUT") without > > test in any form, assuming it goes in line with the tunable above but without > > "X minutes" taken into account. > > <snip> > > > > --- a/include/uapi/asm-generic/mman-common.h > > +++ b/include/uapi/asm-generic/mman-common.h > > @@ -69,6 +69,7 @@ > > > > #define MADV_COLD 20 /* deactivate these pages */ > > #define MADV_PAGEOUT 21 /* reclaim these pages */ > > +#define MADV_CCPC 22 /* reclaim cold & clean page cache pages */ > > This patch adds a new madvise flag. I have a hard time seeing how that > would help with the "full system expiry" of pages? > It works on the basis of individual process now. Shrinking all ccpc pages in the system without memory pressure...they will be reclaimed once memory becomes tight. > The basic point that I tried to make above was that I would ideally like > to have a coldness cutoff date at which you can be pretty confident that > page cache data is no longer needed. > The X minutes need another define like #define MADV_DCPC 23 /* deactivate clean page cache pages */ > To work properly, this needs to be transparent to any normal process on > the system :). then task-A on the system can hint kernel like madvise(MADV_DCPC); /* make clean pc pages cold */ X minutes go by; /* sieve out hot pages */ madvise(MADV_CCPC); /* shrink ccpc */