summaryrefslogtreecommitdiffstats
path: root/mm/internal.h
diff options
context:
space:
mode:
authorNick Piggin <npiggin@suse.de>2006-03-22 00:08:40 -0800
committerLinus Torvalds <torvalds@g5.osdl.org>2006-03-22 07:54:02 -0800
commit7835e98b2e3c66dba79cb0ff8ebb90a2fe030c29 (patch)
tree405a96eade34845dabe2f125b6c5eb095846869d /mm/internal.h
parent70dc991d66cac40fdb07346dba2b5d862d732c34 (diff)
downloadlinux-7835e98b2e3c66dba79cb0ff8ebb90a2fe030c29.tar.bz2
[PATCH] remove set_page_count() outside mm/
set_page_count usage outside mm/ is limited to setting the refcount to 1. Remove set_page_count from outside mm/, and replace those users with init_page_count() and set_page_refcounted(). This allows more debug checking, and tighter control on how code is allowed to play around with page->_count. Signed-off-by: Nick Piggin <npiggin@suse.de> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'mm/internal.h')
-rw-r--r--mm/internal.h13
1 files changed, 12 insertions, 1 deletions
diff --git a/mm/internal.h b/mm/internal.h
index 7bb339779818..d20e3cc4aef0 100644
--- a/mm/internal.h
+++ b/mm/internal.h
@@ -13,8 +13,19 @@
#include <linux/mm.h>
-static inline void set_page_refs(struct page *page, int order)
+static inline void set_page_count(struct page *page, int v)
{
+ atomic_set(&page->_count, v);
+}
+
+/*
+ * Turn a non-refcounted page (->_count == 0) into refcounted with
+ * a count of one.
+ */
+static inline void set_page_refcounted(struct page *page)
+{
+ BUG_ON(PageCompound(page) && page_private(page) != (unsigned long)page);
+ BUG_ON(atomic_read(&page->_count));
set_page_count(page, 1);
}