Commit 2b341443 authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] put_page() consolidation

Clean up put_page() and page_cache_release().  It's pretty simple now:

#define page_cache_get(page)           get_page(page)
#define page_cache_release(page)       put_page(page)
parent e035a047
......@@ -181,6 +181,12 @@ struct page {
#endif /* CONFIG_HIGMEM || WANT_PAGE_VIRTUAL */
};
/*
* FIXME: take this include out, include page-flags.h in
* files which need it (119 of them)
*/
#include <linux/page-flags.h>
/*
* Methods to modify the page usage count.
*
......@@ -202,14 +208,16 @@ struct page {
})
#define page_count(p) atomic_read(&(p)->count)
#define set_page_count(p,v) atomic_set(&(p)->count, v)
extern void FASTCALL(__page_cache_release(struct page *));
#define put_page(p) \
do { \
if (!PageReserved(p) && put_page_testzero(p)) \
__page_cache_release(p); \
} while (0)
void FASTCALL(__free_pages_ok(struct page *page, unsigned int order));
static inline void put_page(struct page *page)
{
if (!PageReserved(page) && put_page_testzero(page))
__page_cache_release(page);
}
/*
* Multiple processes may "see" the same page. E.g. for untouched
* mappings of /dev/null, all processes see the same page full of
......@@ -259,12 +267,6 @@ void FASTCALL(__free_pages_ok(struct page *page, unsigned int order));
* to swap space and (later) to be read back into memory.
*/
/*
* FIXME: take this include out, include page-flags.h in
* files which need it (119 of them)
*/
#include <linux/page-flags.h>
/*
* The zone field is never updated after free_area_init_core()
* sets it, so none of the operations on it need to be atomic.
......
......@@ -22,13 +22,8 @@
#define PAGE_CACHE_MASK PAGE_MASK
#define PAGE_CACHE_ALIGN(addr) (((addr)+PAGE_CACHE_SIZE-1)&PAGE_CACHE_MASK)
#define page_cache_get(x) get_page(x)
static inline void page_cache_release(struct page *page)
{
if (!PageReserved(page) && put_page_testzero(page))
__page_cache_release(page);
}
#define page_cache_get(page) get_page(page)
#define page_cache_release(page) put_page(page)
static inline struct page *page_cache_alloc(struct address_space *x)
{
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment