Skip to content

Commit

Permalink
mm/hmm: do not check pmd_protnone twice in hmm_vma_handle_pmd()
Browse files Browse the repository at this point in the history
pmd_to_hmm_pfn_flags() already checks it and makes the cpu flags 0. If no
fault is requested then the pfns should be returned with the not valid
flags.

It should not unconditionally fault if faulting is not requested.

Fixes: 2aee09d ("mm/hmm: change hmm_vma_fault() to allow write fault on page basis")
Reviewed-by: Ralph Campbell <rcampbell@nvidia.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
  • Loading branch information
Jason Gunthorpe committed Mar 26, 2020
1 parent 4055062 commit 24cee8a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion mm/hmm.c
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ static int hmm_vma_handle_pmd(struct mm_walk *walk, unsigned long addr,
hmm_range_need_fault(hmm_vma_walk, pfns, npages, cpu_flags,
&fault, &write_fault);

if (pmd_protnone(pmd) || fault || write_fault)
if (fault || write_fault)
return hmm_vma_walk_hole_(addr, end, fault, write_fault, walk);

pfn = pmd_pfn(pmd) + ((addr & ~PMD_MASK) >> PAGE_SHIFT);
Expand Down

0 comments on commit 24cee8a

Please sign in to comment.