diff mbox series

[v3,07/16] mm/huge_memory: use helper function vma_lookup in split_huge_pages_pid

Message ID 20220704132201.14611-8-linmiaohe@huawei.com (mailing list archive)
State New
Headers show
Series A few cleanup patches for huge_memory | expand

Commit Message

Miaohe Lin July 4, 2022, 1:21 p.m. UTC
Use helper function vma_lookup to lookup the needed vma to simplify the
code. Minor readability improvement.

Signed-off-by: Miaohe Lin <linmiaohe@huawei.com>
---
 mm/huge_memory.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Muchun Song July 4, 2022, 1:54 p.m. UTC | #1
On Mon, Jul 04, 2022 at 09:21:52PM +0800, Miaohe Lin wrote:
> Use helper function vma_lookup to lookup the needed vma to simplify the
> code. Minor readability improvement.
> 
> Signed-off-by: Miaohe Lin <linmiaohe@huawei.com>

Reviewed-by: Muchun Song <songmuchun@bytedance.com>

Thanks.
diff mbox series

Patch

diff --git a/mm/huge_memory.c b/mm/huge_memory.c
index f2856cfac900..5f5123130b28 100644
--- a/mm/huge_memory.c
+++ b/mm/huge_memory.c
@@ -3045,10 +3045,10 @@  static int split_huge_pages_pid(int pid, unsigned long vaddr_start,
 	 * table filled with PTE-mapped THPs, each of which is distinct.
 	 */
 	for (addr = vaddr_start; addr < vaddr_end; addr += PAGE_SIZE) {
-		struct vm_area_struct *vma = find_vma(mm, addr);
+		struct vm_area_struct *vma = vma_lookup(mm, addr);
 		struct page *page;
 
-		if (!vma || addr < vma->vm_start)
+		if (!vma)
 			break;
 
 		/* skip special VMA and hugetlb VMA */