Skip to content

Commit fde26be

Browse files
Anshuman Khandualtorvalds
authored andcommitted
mm/memory.c: remove reduntant check for write access
Flags argument has been copied into vmf.flags and it is not changed in between. Hence a single write access check can be used for both PUD and PMD. Link: http://lkml.kernel.org/r/20170823082839.1812-1-khandual@linux.vnet.ibm.com Signed-off-by: Anshuman Khandual <khandual@linux.vnet.ibm.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent 656710a commit fde26be

1 file changed

Lines changed: 2 additions & 3 deletions

File tree

‎mm/memory.c‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3961,6 +3961,7 @@ static int __handle_mm_fault(struct vm_area_struct *vma, unsigned long address,
39613961
.pgoff = linear_page_index(vma, address),
39623962
.gfp_mask = __get_fault_gfp_mask(vma),
39633963
};
3964+
unsigned int dirty = flags & FAULT_FLAG_WRITE;
39643965
struct mm_struct *mm = vma->vm_mm;
39653966
pgd_t *pgd;
39663967
p4d_t *p4d;
@@ -3983,7 +3984,6 @@ static int __handle_mm_fault(struct vm_area_struct *vma, unsigned long address,
39833984

39843985
barrier();
39853986
if (pud_trans_huge(orig_pud) || pud_devmap(orig_pud)) {
3986-
unsigned int dirty = flags & FAULT_FLAG_WRITE;
39873987

39883988
/* NUMA case for anonymous PUDs would go here */
39893989

@@ -4020,8 +4020,7 @@ static int __handle_mm_fault(struct vm_area_struct *vma, unsigned long address,
40204020
if (pmd_protnone(orig_pmd) && vma_is_accessible(vma))
40214021
return do_huge_pmd_numa_page(&vmf, orig_pmd);
40224022

4023-
if ((vmf.flags & FAULT_FLAG_WRITE) &&
4024-
!pmd_write(orig_pmd)) {
4023+
if (dirty && !pmd_write(orig_pmd)) {
40254024
ret = wp_huge_pmd(&vmf, orig_pmd);
40264025
if (!(ret & VM_FAULT_FALLBACK))
40274026
return ret;

0 commit comments

Comments
 (0)