aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/mm.h
diff options
context:
space:
mode:
authorAndrea Arcangeli <aarcange@redhat.com>2011-01-13 18:46:32 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2011-01-13 20:32:38 -0500
commite9da73d67729b58bba256123e2b4651e0d8a01ac (patch)
tree5e7f8c4d394d625f7832cbd04a8d55f9f0cd0d95 /include/linux/mm.h
parenta826e422420b461a6247137c292ff83c4800354a (diff)
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.h34
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 @@
14#include <linux/mm_types.h> 14#include <linux/mm_types.h>
15#include <linux/range.h> 15#include <linux/range.h>
16#include <linux/pfn.h> 16#include <linux/pfn.h>
17#include <linux/bit_spinlock.h>
17 18
18struct mempolicy; 19struct mempolicy;
19struct anon_vma; 20struct anon_vma;
@@ -305,6 +306,39 @@ static inline int is_vmalloc_or_module_addr(const void *x)
305} 306}
306#endif 307#endif
307 308
309static inline void compound_lock(struct page *page)
310{
311#ifdef CONFIG_TRANSPARENT_HUGEPAGE
312 bit_spin_lock(PG_compound_lock, &page->flags);
313#endif
314}
315
316static inline void compound_unlock(struct page *page)
317{
318#ifdef CONFIG_TRANSPARENT_HUGEPAGE
319 bit_spin_unlock(PG_compound_lock, &page->flags);
320#endif
321}
322
323static inline unsigned long compound_lock_irqsave(struct page *page)
324{
325 unsigned long uninitialized_var(flags);
326#ifdef CONFIG_TRANSPARENT_HUGEPAGE
327 local_irq_save(flags);
328 compound_lock(page);
329#endif
330 return flags;
331}
332
333static inline void compound_unlock_irqrestore(struct page *page,
334 unsigned long flags)
335{
336#ifdef CONFIG_TRANSPARENT_HUGEPAGE
337 compound_unlock(page);
338 local_irq_restore(flags);
339#endif
340}
341
308static inline struct page *compound_head(struct page *page) 342static inline struct page *compound_head(struct page *page)
309{ 343{
310 if (unlikely(PageTail(page))) 344 if (unlikely(PageTail(page)))