From 89154dd5313f774d3a592451360b78442571b1f8 Mon Sep 17 00:00:00 2001 From: Michel Lespinasse Date: Mon, 8 Jun 2020 21:33:29 -0700 Subject: mmap locking API: convert mmap_sem call sites missed by coccinelle Convert the last few remaining mmap_sem rwsem calls to use the new mmap locking API. These were missed by coccinelle for some reason (I think coccinelle does not support some of the preprocessor constructs in these files ?) [akpm@linux-foundation.org: convert linux-next leftovers] [akpm@linux-foundation.org: more linux-next leftovers] [akpm@linux-foundation.org: more linux-next leftovers] Signed-off-by: Michel Lespinasse Signed-off-by: Andrew Morton Reviewed-by: Daniel Jordan Reviewed-by: Laurent Dufour Reviewed-by: Vlastimil Babka Cc: Davidlohr Bueso Cc: David Rientjes Cc: Hugh Dickins Cc: Jason Gunthorpe Cc: Jerome Glisse Cc: John Hubbard Cc: Liam Howlett Cc: Matthew Wilcox Cc: Peter Zijlstra Cc: Ying Han Link: http://lkml.kernel.org/r/20200520052908.204642-6-walken@google.com Signed-off-by: Linus Torvalds --- lib/test_hmm.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'lib') diff --git a/lib/test_hmm.c b/lib/test_hmm.c index 5c1858e325ba..28528285942c 100644 --- a/lib/test_hmm.c +++ b/lib/test_hmm.c @@ -245,9 +245,9 @@ static int dmirror_range_fault(struct dmirror *dmirror, } range->notifier_seq = mmu_interval_read_begin(range->notifier); - down_read(&mm->mmap_sem); + mmap_read_lock(mm); ret = hmm_range_fault(range); - up_read(&mm->mmap_sem); + mmap_read_unlock(mm); if (ret) { if (ret == -EBUSY) continue; @@ -686,7 +686,7 @@ static int dmirror_migrate(struct dmirror *dmirror, if (!mmget_not_zero(mm)) return -EINVAL; - down_read(&mm->mmap_sem); + mmap_read_lock(mm); for (addr = start; addr < end; addr = next) { vma = find_vma(mm, addr); if (!vma || addr < vma->vm_start || @@ -713,7 +713,7 @@ static int dmirror_migrate(struct dmirror *dmirror, dmirror_migrate_finalize_and_map(&args, dmirror); migrate_vma_finalize(&args); } - up_read(&mm->mmap_sem); + mmap_read_unlock(mm); mmput(mm); /* Return the migrated data for verification. */ @@ -733,7 +733,7 @@ static int dmirror_migrate(struct dmirror *dmirror, return ret; out: - up_read(&mm->mmap_sem); + mmap_read_unlock(mm); mmput(mm); return ret; } @@ -825,9 +825,9 @@ static int dmirror_range_snapshot(struct dmirror *dmirror, range->notifier_seq = mmu_interval_read_begin(range->notifier); - down_read(&mm->mmap_sem); + mmap_read_lock(mm); ret = hmm_range_fault(range); - up_read(&mm->mmap_sem); + mmap_read_unlock(mm); if (ret) { if (ret == -EBUSY) continue; -- cgit v1.2.3