diff options
author | Kirill A. Shutemov <kirill.shutemov@linux.intel.com> | 2016-03-17 17:19:11 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2016-03-17 18:09:34 -0400 |
commit | 3ed3a4f0ddffece942bb2661924d87be4ce63cb7 (patch) | |
tree | 3b47bba0ba26a0301339f4989a57346e0f76b989 /mm/memory.c | |
parent | 5057dcd0f1aaad57e07e728ba20a99e205c6b9de (diff) |
mm: cleanup *pte_alloc* interfaces
There are few things about *pte_alloc*() helpers worth cleaning up:
- 'vma' argument is unused, let's drop it;
- most __pte_alloc() callers do speculative check for pmd_none(),
before taking ptl: let's introduce pte_alloc() macro which does
the check.
The only direct user of __pte_alloc left is userfaultfd, which has
different expectation about atomicity wrt pmd.
- pte_alloc_map() and pte_alloc_map_lock() are redefined using
pte_alloc().
[sudeep.holla@arm.com: fix build for arm64 hugetlbpage]
[sfr@canb.auug.org.au: fix arch/arm/mm/mmu.c some more]
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Cc: Dave Hansen <dave.hansen@intel.com>
Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
Acked-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
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.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/mm/memory.c b/mm/memory.c index 0e247642ed5b..1974fc02c4d0 100644 --- a/mm/memory.c +++ b/mm/memory.c | |||
@@ -562,8 +562,7 @@ void free_pgtables(struct mmu_gather *tlb, struct vm_area_struct *vma, | |||
562 | } | 562 | } |
563 | } | 563 | } |
564 | 564 | ||
565 | int __pte_alloc(struct mm_struct *mm, struct vm_area_struct *vma, | 565 | int __pte_alloc(struct mm_struct *mm, pmd_t *pmd, unsigned long address) |
566 | pmd_t *pmd, unsigned long address) | ||
567 | { | 566 | { |
568 | spinlock_t *ptl; | 567 | spinlock_t *ptl; |
569 | pgtable_t new = pte_alloc_one(mm, address); | 568 | pgtable_t new = pte_alloc_one(mm, address); |
@@ -3419,12 +3418,11 @@ static int __handle_mm_fault(struct mm_struct *mm, struct vm_area_struct *vma, | |||
3419 | } | 3418 | } |
3420 | 3419 | ||
3421 | /* | 3420 | /* |
3422 | * Use __pte_alloc instead of pte_alloc_map, because we can't | 3421 | * Use pte_alloc() instead of pte_alloc_map, because we can't |
3423 | * run pte_offset_map on the pmd, if an huge pmd could | 3422 | * run pte_offset_map on the pmd, if an huge pmd could |
3424 | * materialize from under us from a different thread. | 3423 | * materialize from under us from a different thread. |
3425 | */ | 3424 | */ |
3426 | if (unlikely(pmd_none(*pmd)) && | 3425 | if (unlikely(pte_alloc(mm, pmd, address))) |
3427 | unlikely(__pte_alloc(mm, vma, pmd, address))) | ||
3428 | return VM_FAULT_OOM; | 3426 | return VM_FAULT_OOM; |
3429 | /* | 3427 | /* |
3430 | * If a huge pmd materialized under us just retry later. Use | 3428 | * If a huge pmd materialized under us just retry later. Use |