[PATCH 02 of 25] compound_lock

Andrea Arcangeli
2009-11-14T18:10:26Z

Add a new compound_lock() needed to serialize put_page against
__split_huge_page_refcount().

Signed-off-by: Andrea Arcangeli <aarcange@redhat.com>
---

diff --git a/include/linux/mm.h b/include/linux/mm.h
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -12,6 +12,7 @@
#include <linux/prio_tree.h>
#include <linux/debug_locks.h>
#include <linux/mm_types.h>
+#include <linux/bit_spinlock.h>

struct mempolicy;
struct anon_vma;
@@ -294,6 +295,16 @@ static inline int is_vmalloc_or_module_a
}
#endif

+static inline void compound_lock(struct page *page)
+{
+ bit_spin_lock(PG_compound_lock, &page->flags);
+}
+
+static inline void compound_unlock(struct page *page)
+{
+ bit_spin_unlock(PG_compound_lock, &page->flags);
+}
+
static inline struct page *compound_head(struct page *page)
{
if (unlikely(PageTail(page)))
diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h
--- a/include/linux/page-flags.h
+++ b/include/linux/page-flags.h
@@ -108,6 +108,7 @@ enum pageflags {
#ifdef CONFIG_MEMORY_FAILURE
PG_hwpoison, /* hardware poisoned page. Don't touch */
#endif
+ PG_compound_lock,
__NR_PAGEFLAGS,

/* Filesystems */