diff options
author | Andrea Arcangeli <aarcange@redhat.com> | 2011-01-13 15:46:32 -0800 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2011-01-13 17:32:38 -0800 |
commit | e9da73d67729b58bba256123e2b4651e0d8a01ac (patch) | |
tree | 5e7f8c4d394d625f7832cbd04a8d55f9f0cd0d95 /include/linux/mm.h | |
parent | a826e422420b461a6247137c292ff83c4800354a (diff) | |
download | linux-e9da73d67729b58bba256123e2b4651e0d8a01ac.tar.gz linux-e9da73d67729b58bba256123e2b4651e0d8a01ac.tar.bz2 linux-e9da73d67729b58bba256123e2b4651e0d8a01ac.zip |
thp: compound_lock
Add a new compound_lock() needed to serialize put_page against
__split_huge_page_refcount().
Signed-off-by: Andrea Arcangeli <aarcange@redhat.com>
Acked-by: Rik van Riel <riel@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'include/linux/mm.h')
-rw-r--r-- | include/linux/mm.h | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/include/linux/mm.h b/include/linux/mm.h index 57e11b2a18ba..3b1754ad8785 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -14,6 +14,7 @@ #include <linux/mm_types.h> #include <linux/range.h> #include <linux/pfn.h> +#include <linux/bit_spinlock.h> struct mempolicy; struct anon_vma; @@ -305,6 +306,39 @@ static inline int is_vmalloc_or_module_addr(const void *x) } #endif +static inline void compound_lock(struct page *page) +{ +#ifdef CONFIG_TRANSPARENT_HUGEPAGE + bit_spin_lock(PG_compound_lock, &page->flags); +#endif +} + +static inline void compound_unlock(struct page *page) +{ +#ifdef CONFIG_TRANSPARENT_HUGEPAGE + bit_spin_unlock(PG_compound_lock, &page->flags); +#endif +} + +static inline unsigned long compound_lock_irqsave(struct page *page) +{ + unsigned long uninitialized_var(flags); +#ifdef CONFIG_TRANSPARENT_HUGEPAGE + local_irq_save(flags); + compound_lock(page); +#endif + return flags; +} + +static inline void compound_unlock_irqrestore(struct page *page, + unsigned long flags) +{ +#ifdef CONFIG_TRANSPARENT_HUGEPAGE + compound_unlock(page); + local_irq_restore(flags); +#endif +} + static inline struct page *compound_head(struct page *page) { if (unlikely(PageTail(page))) |