Re: SetPageDirty in shmem_nopage

Linus Torvalds (torvalds@transmeta.com)
Sun, 14 Jan 2001 11:20:45 -0800 (PST)


On 14 Jan 2001, Christoph Rohland wrote:
>
> Since we do not mark the page dirty at allocation time the vm can drop
> it at any time as long as it is not written to. But shmem never
> adjusts its accounting to that and will happily increase the use
> counter for both the inode and the fs.

Why do you increment the use counter at all in nopage?

There's something wrong here. You shouldn't need to calculate any of this.
The VM layer already keeps track of how many pages are associated with a
mapping in "mapping->nr_pages". Why do you maintain extra counters that
do not give you anything at all?

You should count how many swap cache entries you have allocated for this
inode, and nothing more - the VM keeps track of everything else for you
already. It looks like this code is all historical baggage from when the
shm code didn't use the VM page cache? I'd rather remove it than try to
edit it, no?

Linus

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/