diff options
author | Kirill A. Shutemov <kirill.shutemov@linux.intel.com> | 2013-11-05 17:06:59 +1100 |
---|---|---|
committer | Stephen Rothwell <sfr@canb.auug.org.au> | 2013-11-05 17:40:20 +1100 |
commit | 11010c0f91ee20ba3a504f82ab317947e4d41b19 (patch) | |
tree | 934479b23795e87156dd0d6329994659c6607a9b /include | |
parent | 829e0b6e7ceba9134befd2acc9acb3ad0c4dc96f (diff) |
mm: try to detect that page->ptl is in use
prep_new_page() initialize page->private (and therefore page->ptl) with 0.
Make sure nobody took it in use in between allocation of the page and
page table constructor.
It can happen if arch try to use slab for page table allocation: slab code
uses page->slab_cache and page->first_page (for tail pages), which share
storage with page->ptl.
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/mm.h | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/include/linux/mm.h b/include/linux/mm.h index d2af6a5da5e2..d0339741b6ce 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -1346,6 +1346,15 @@ static inline spinlock_t *pte_lockptr(struct mm_struct *mm, pmd_t *pmd) static inline bool ptlock_init(struct page *page) { + /* + * prep_new_page() initialize page->private (and therefore page->ptl) + * with 0. Make sure nobody took it in use in between. + * + * It can happen if arch try to use slab for page table allocation: + * slab code uses page->slab_cache and page->first_page (for tail + * pages), which share storage with page->ptl. + */ + VM_BUG_ON(page->ptl); if (!ptlock_alloc(page)) return false; spin_lock_init(ptlock_ptr(page)); |