mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-21 22:21:21 +00:00
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>
This commit is contained in:
parent
a826e42242
commit
e9da73d677
2 changed files with 45 additions and 1 deletions
|
@ -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)))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue