Messages in this thread | | | Date | Thu, 8 Oct 1998 14:11:28 -0400 (EDT) | From | Kenneth Albanowski <> | Subject | Re: 'disposable' dirty pages [was: Out Of Memory in v. 2.1] |
| |
On Thu, 8 Oct 1998, Alan Cox wrote:
> > > Not if you marked it discardable - you just said that zeroed it. > > Well, that's the issue. It's more efficient if it doesn't. > > When you discard a page you will need to put something back on a fault > in. Thats going to be the zero page so the cost is basically nil.
I'm thinking of the common case, the page is marked discardable, but is then touched (read or write) before being discarded. Should the touch automatically zero the page? That would result in identical semantics whether or not the page had been discarded.
> Its far more useful than a straight forward reclaim of zeroed pages > because apps that know about it can use reclaimable memory for things > like pixmap caches providing there is a suitable way to get info on what > was discarded.
OK, that answers the question. This (and what mingo adds) suggests that the original content will be useful if the page has not been discarded. That means if you want to use discardable pages as a method of zeroing pages, you'll need to zero the page yourself before discarding it. (There's no reason malloc _has_ to do this, it's just a matter of providing a deterministic environment to placate buggy code.)
As for the pixmap cache idea: I thought for a moment that there would be race conditions, but since the first touch will clear the discardable flag, this doesn't feel like a problem. Some non-zero data in the page will be sufficient to recognize that the page is still present. The only issue is whether a pixmap (or whatever) cache is any use if individual pages can drop out.
Hmm. This is, however, starting to sound like we need to distinguish between different levels of "discardable". E.g., "discardable if the universe will end if we won't", vs. "go ahead, I wasn't using it anyhow". And an aging mechanism also needs to be tied in, so that the least used pages will be harvested in preference to the most used.
-- Kenneth Albanowski (kjahds@kjahds.com, CIS: 70705,126)
- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/
| |