| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * Copyright 2017 IBM Corp. |
|---|
| 3 | | - * |
|---|
| 4 | | - * This program is free software; you can redistribute it and/or |
|---|
| 5 | | - * modify it under the terms of the GNU General Public License |
|---|
| 6 | | - * as published by the Free Software Foundation; either version |
|---|
| 7 | | - * 2 of the License, or (at your option) any later version. |
|---|
| 8 | 4 | */ |
|---|
| 9 | 5 | |
|---|
| 10 | 6 | #include <linux/hugetlb.h> |
|---|
| .. | .. |
|---|
| 211 | 207 | struct vm_area_struct *vma = NULL; |
|---|
| 212 | 208 | int rc = 0; |
|---|
| 213 | 209 | |
|---|
| 214 | | - down_read(&mm->mmap_sem); |
|---|
| 210 | + mmap_read_lock(mm); |
|---|
| 215 | 211 | |
|---|
| 216 | 212 | vma = find_vma(mm, addr); |
|---|
| 217 | 213 | if (!vma) { |
|---|
| .. | .. |
|---|
| 222 | 218 | *vma_start = vma->vm_start; |
|---|
| 223 | 219 | *vma_end = vma->vm_end; |
|---|
| 224 | 220 | out: |
|---|
| 225 | | - up_read(&mm->mmap_sem); |
|---|
| 221 | + mmap_read_unlock(mm); |
|---|
| 226 | 222 | return rc; |
|---|
| 227 | 223 | } |
|---|
| 228 | 224 | |
|---|
| .. | .. |
|---|
| 249 | 245 | dar += page_size) { |
|---|
| 250 | 246 | if (dar < vma_start || dar >= vma_end) { |
|---|
| 251 | 247 | /* |
|---|
| 252 | | - * We don't hold the mm->mmap_sem semaphore |
|---|
| 253 | | - * while iterating, since the semaphore is |
|---|
| 254 | | - * required by one of the lower-level page |
|---|
| 248 | + * We don't hold mm->mmap_lock while iterating, since |
|---|
| 249 | + * the lock is required by one of the lower-level page |
|---|
| 255 | 250 | * fault processing functions and it could |
|---|
| 256 | 251 | * create a deadlock. |
|---|
| 257 | 252 | * |
|---|