Re: [RFC] Arch option to touch newly allocated pages

Jeff Dike
2002-03-07T00:28:13Z

dwmw2@infradead.org said:
> MADV_DONTNEED
> Do not expect access in the near future. (For the
> time being, the application is finished with the
> given range, so the kernel can free resources asso­
> ciated with it.)
> It's not clear from that that the host kernel is actually permitted to
> discard the data.

Hmmm, you have better man pages than me. I don't have an madvise man page
on either of my boxes (RH 6.2 and 7.2 :-)

>From that description, you're right. The code is very clear on what happens,
as is the comment above sys_madvise:

* MADV_DONTNEED - the application is finished with the given range,
* so the kernel can free resources associated with it.

> UML might want that kind of thing for its (clean) page cache pages or
> something, but for pages allocated for kernel stack and task struct we
> really want the opposite -- we want to make sure they're present when
> we allocate them, and explicitly discard them when we're done.

Yeah, that's a decent idea. If you were going to make it fancier, you could
cover the case that the UML's clean pages are all busy but it has lots of
old dirty pages lying around. But then you'd need some way for the host to
tell the UML that I/O would be a really bad idea and it should just dump
clean pages.

Jeff