aboutsummaryrefslogtreecommitdiffstats
path: root/mm/memory.c
diff options
context:
space:
mode:
authorPeter Zijlstra <peterz@infradead.org>2013-11-14 17:31:52 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2013-11-14 19:32:20 -0500
commit539edb5846c740d78a8b6c2e43a99ca4323df68f (patch)
treedd03e1a7149f101f42311eac41e2857816cce36c /mm/memory.c
parent49076ec2ccaf68610aa03d96bced9a6694b93ca1 (diff)
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>
Diffstat (limited to 'mm/memory.c')
-rw-r--r--mm/memory.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/mm/memory.c b/mm/memory.c
index 24ffae2a530e..5d9025f3b3e1 100644
--- a/mm/memory.c
+++ b/mm/memory.c
@@ -4271,21 +4271,20 @@ void copy_user_huge_page(struct page *dst, struct page *src,
4271} 4271}
4272#endif /* CONFIG_TRANSPARENT_HUGEPAGE || CONFIG_HUGETLBFS */ 4272#endif /* CONFIG_TRANSPARENT_HUGEPAGE || CONFIG_HUGETLBFS */
4273 4273
4274#if USE_SPLIT_PTE_PTLOCKS 4274#if USE_SPLIT_PTE_PTLOCKS && BLOATED_SPINLOCKS
4275bool __ptlock_alloc(struct page *page) 4275bool ptlock_alloc(struct page *page)
4276{ 4276{
4277 spinlock_t *ptl; 4277 spinlock_t *ptl;
4278 4278
4279 ptl = kmalloc(sizeof(spinlock_t), GFP_KERNEL); 4279 ptl = kmalloc(sizeof(spinlock_t), GFP_KERNEL);
4280 if (!ptl) 4280 if (!ptl)
4281 return false; 4281 return false;
4282 page->ptl = (unsigned long)ptl; 4282 page->ptl = ptl;
4283 return true; 4283 return true;
4284} 4284}
4285 4285
4286void __ptlock_free(struct page *page) 4286void ptlock_free(struct page *page)
4287{ 4287{
4288 if (sizeof(spinlock_t) > sizeof(page->ptl)) 4288 kfree(page->ptl);
4289 kfree((spinlock_t *)page->ptl);
4290} 4289}
4291#endif 4290#endif