Re: [patch 6/12] hold atomic kmaps across generic_file_read

Linus Torvalds
2002-08-11T18:54:42Z

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.

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.

See? You actually _do_ have choices on what to do.

Linus