summaryrefslogtreecommitdiff
path: root/include/linux
diff options
context:
space:
mode:
authorAndrew Morton <akpm@zip.com.au>2002-08-14 21:21:10 -0700
committerLinus Torvalds <torvalds@home.transmeta.com>2002-08-14 21:21:10 -0700
commiteed29d66442c0e6babcea33ab03f02cdf49e62af (patch)
tree88e50119cdc4c3673c1494e897b099a925b3ba10 /include/linux
parentaaba9265318483297267400fbfce1c399b3ac018 (diff)
[PATCH] pagemap_lru_lock wrapup
Some fallout from the pagemap_lru_lock changes: - lru_cache_del() is no longer used. Kill it. - page_cache_release() almost never actually frees pages. So inline page_cache_release() and move its rarely-called slow path into (the misnamed) mm/swap.c - update the locking comment in filemap.c. pagemap_lru_lock used to be one of the outermost locks in the VM locking hierarchy. Now, we never take any other locks while holding pagemap_lru_lock. So it doesn't have any relationship with anything. - put_page() now removes pages from the LRU on the final put. The lock is interrupt safe.
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/mm.h7
-rw-r--r--include/linux/pagemap.h8
-rw-r--r--include/linux/swap.h2
3 files changed, 12 insertions, 5 deletions
diff --git a/include/linux/mm.h b/include/linux/mm.h
index df42d899e41f..4d7de397481f 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -194,11 +194,16 @@ struct page {
* routine so they can be sure the page doesn't go away from under them.
*/
#define get_page(p) atomic_inc(&(p)->count)
-#define put_page(p) __free_page(p)
#define __put_page(p) atomic_dec(&(p)->count)
#define put_page_testzero(p) atomic_dec_and_test(&(p)->count)
#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 (put_page_testzero(p)) \
+ __page_cache_release(p); \
+ } while (0)
/*
* Multiple processes may "see" the same page. E.g. for untouched
diff --git a/include/linux/pagemap.h b/include/linux/pagemap.h
index 69e214920908..ff10783f8632 100644
--- a/include/linux/pagemap.h
+++ b/include/linux/pagemap.h
@@ -23,14 +23,18 @@
#define PAGE_CACHE_ALIGN(addr) (((addr)+PAGE_CACHE_SIZE-1)&PAGE_CACHE_MASK)
#define page_cache_get(x) get_page(x)
-extern void FASTCALL(page_cache_release(struct page *));
+
+static inline void page_cache_release(struct page *page)
+{
+ if (!PageReserved(page) && put_page_testzero(page))
+ __page_cache_release(page);
+}
static inline struct page *page_cache_alloc(struct address_space *x)
{
return alloc_pages(x->gfp_mask, 0);
}
-
typedef int filler_t(void *, struct page *);
extern struct page * find_get_page(struct address_space *mapping,
diff --git a/include/linux/swap.h b/include/linux/swap.h
index e09e96170182..a7f1f96ff9f1 100644
--- a/include/linux/swap.h
+++ b/include/linux/swap.h
@@ -156,8 +156,6 @@ extern int FASTCALL(page_over_rsslimit(struct page *));
/* linux/mm/swap.c */
extern void FASTCALL(lru_cache_add(struct page *));
-extern void FASTCALL(__lru_cache_del(struct page *));
-extern void FASTCALL(lru_cache_del(struct page *));
extern void FASTCALL(activate_page(struct page *));