Re: Buffer and page cache

V. Ganesh (kernel@kvack.org)
Tue, 2 Nov 1999 17:32:58 -0500 (EST)


On Tue, 2 Nov 1999, V. Ganesh wrote:

> the refcount of a page in the pagecache, clean or dirty is 1 (when it's not
> being currently read/written and not mapped by any process). shrink_mmap
> can recycle it if it's clean. the problem is with the way shrink_mmap
> checks if the page is dirty - it checks if any of page->buffers is busy.
> if page->buffers is NULL, it just assumes the page is clean and recycles it.
>
> stephen suggested bumping up the refcount to avoid this problem, but I don't
> quite see where this can be done.

Ah. I suppose I was incomplete in expressing my thought, and I'll try
again: I was thinking that in your writepage function, you could mark it
dirty and bump the page count. Since the page's lock is held when
writepage is called, you don't have to worry about incrementing count
twice. Multiple writepage()s can occur simultaneously, whereas only one
write() can occur on a file at one time. Am I making sense? In any case,
if you haven't looked over Eric's shmfs patches (see the linux-mm
archives), do -- he implemented dirty pages in the page cache, which will
be worth revisting during 2.5.

-ben

-
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/