On Sunday 11 August 2002 21:00, Linus Torvalds wrote:
> On Sun, 11 Aug 2002, Daniel Phillips wrote:
>
> > On Sunday 11 August 2002 00:42, Linus Torvalds wrote:
> > > For example, what do you do when somebody has a COW-page mapped into it's
> > > VM space and you want to start paging stuff out?
> >
> > Clearly it requires a CoW break and swapping out that page won't free any
> > memory directly, but it will in turn allow the cache page to be dropped.
>
> Well, that's the point. Is it really "clearly"?
>
> One alternative is to just instead remove it from the page cache, and add
> it to the swap cache directly (and unmapping it). In fact, I _think_ that
> is the right thing to do (yes, it only works if the page count is 2 (one
> for page cache, one for the VM mapping), but that's very different from
> breaking the COW and generating two separate pages.
Far clearer ;-)
With reverse mapping it works for any page count.
> The "move directly to swap cache" is nice in that it doesn't add any new
> pages. But it's nasty in that it steals pages from the file cache, so that
> it basically turns a potentially sharable cache into a private cache that
> nobody else will see.
But you got it right the first time: we're evicting the page because it's
inactive and we want the memory for something else. We don't need to give
that page more second chances, it already had its share of chances before
it got this far in the eviction process. If the file page gets reloaded
before the swap-out completes it just means we chose the victim poorly
in the first place, or we're unlucky. The latter is supposed to be the
exception, not the rule.
> See? You actually _do_ have choices on what to do.
Yes, in this case, the correct thing and the dumb thing.
-- Daniel - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
This archive was generated by hypermail 2b29 : Thu Aug 15 2002 - 22:00:25 EST