Re: how does generic_file_read work with page_cache?

V. Ganesh (ganesh@veritas.com)
Fri, 17 Sep 1999 14:17:40 -0700 (PDT)


> From: "Peter J. Braam" <braam@cs.cmu.edu>
> Date: Wed, 22 Sep 1999 03:39:07 +0000

[snip]

> - functions reading the page do a page_get -- but there is no page_put,
> instead they call the un-understandable page_cache_release.
>
> Below in the snippet from generic_page read, the normal path does:
>
> get_page(page)
> if all is well copy the data from the page
> page_cache_release(page)
>
> But the latter is in fact __free_page(page) which is defined in
> page_alloc.c and is very appropriately labeled as "You really aren't
> expected to understand this".
>
> - What does that function do with the page?
> - Who sets back the page count, which was increased by get_page?
> - How can I operate with pages in a file system?

yeah, that is somewhat silly. it should have been put_page(page) rather
than page_cache_release(page) if only for clarity. anyway, put_page
is also #defined to be __free_page.
it's __free_page which decrements the page count. if the count drops to zero,
then __free_page really frees the page i.e. puts it back into the free page
list, merging with buddy if possible, etc.

ganesh

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