Re: userspace pagecache management tool

Andrew Morton
2007-03-03T22:15:00Z

On Sat, 3 Mar 2007 22:41:09 +0100 bert hubert <bert.hubert@netherlabs.nl> wrote:

> > How can you make global policy decisions based on the intent
> > of one program?
>
> By not doing so.

yup.

> Andrew's program is fine in principle, except that the
> linux kernel treats the communication of a program's intent as a global
> instruction.

argh.

That felt good - let's do it again.

argh.

It is *not* a global instruction. It uses setenv, so the user's policy
affects only the target process and its forked children.

> Also, Andrew's description is a tad misleasing, as the size of the page
> cache might be altered a lot in case content is accessed that was previously
> cached!

That's true.

Although if the user knows that he'll want to use that data again soon, and
he elects to purge it all from cache beforehand then we're dealing with a pretty
dumb user.

If this user doesn't plan to use the data again, but some other user does,
then he loses.

> With my userspace hat on, I'd love to have a proper way to communicate my
> *program's* expectations to the kernel, without stomping other programs.

That is the aim and effect of this work.

> Also with the same hat on, I hope to rarely *need* to communicate my
> expectations because the kernel correctly predicts many cases.

yup. It's those odd cases where it goes wrong which I'm addressing here.

And of course there's no way for the kernel to work out that it's about to
go wrong - kernel can't read user's mind.

Well. That's not strictly true. One could envisage a database-backed
learning program which observes the users work patterns and, based on
various pattern-matchings, works out what the best strategy is likely to be
when the user starts some operation which he has performed previously.