mm: properly separate the bloated ptl from the regular case

Use kernel/bounds.c to convert build-time spinlock_t size check into a
preprocessor symbol and apply that to properly separate the page::ptl
situation.

Signed-off-by: Peter Zijlstra <peterz@infradead.org>
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Cc: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
Peter Zijlstra
2013-11-14 14:31:52 -08:00
committed by Linus Torvalds
parent 49076ec2cc
commit 539edb5846
4 changed files with 25 additions and 21 deletions

View File

@@ -4271,21 +4271,20 @@ void copy_user_huge_page(struct page *dst, struct page *src,
}
#endif /* CONFIG_TRANSPARENT_HUGEPAGE || CONFIG_HUGETLBFS */
#if USE_SPLIT_PTE_PTLOCKS
bool __ptlock_alloc(struct page *page)
#if USE_SPLIT_PTE_PTLOCKS && BLOATED_SPINLOCKS
bool ptlock_alloc(struct page *page)
{
spinlock_t *ptl;
ptl = kmalloc(sizeof(spinlock_t), GFP_KERNEL);
if (!ptl)
return false;
page->ptl = (unsigned long)ptl;
page->ptl = ptl;
return true;
}
void __ptlock_free(struct page *page)
void ptlock_free(struct page *page)
{
if (sizeof(spinlock_t) > sizeof(page->ptl))
kfree((spinlock_t *)page->ptl);
kfree(page->ptl);
}
#endif