lkml.org 
[lkml]   [1997]   [Jun]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: Page cache and swapping
[snip]
> Looking at shrink_mmap in mm/filemap.c I found, that shared pages (page->count
> > 1) are inviolable. Additionally, the referenced bit is set, so next time
> the page is not freed again, even if it was _not_ used. In other parts of the
> kernel I found that page->count is increased on purpose to lock the page
> in memory. On the other hand, page->count is for page cache pages (with no buffers
> attached to it) the number of processes "seeing" the page. So, I supposed that
> removing a shared, but unused page from page cache should not be disasterous.
> The patch allows removing shared pages from page cache and removes setting
> of the referenced bit for all shared pages.

I'm sorry, but this can't work. There is no such thing as a "shared unused"
page. I suppose you mean "not referenced" by "unused".
Still, your patch doesn't work. You need to guarantee that the page you
are freeing is not in any process page tables. Otherwise, a process could
reference the page after you have freed it. This is usually done by
try_to_swap_out which will in turn remove the page from the memory map of
every process that contains it. After that, it can be freed.

Bernd

\
 
 \ /
  Last update: 2005-03-22 13:39    [W:0.087 / U:0.296 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site