hugetlb: move vm_fault declaration to the top of hugetlb_fault()
authorVishal Moola (Oracle) <vishal.moola@gmail.com>
Wed, 21 Feb 2024 23:47:29 +0000 (15:47 -0800)
committerAndrew Morton <akpm@linux-foundation.org>
Tue, 5 Mar 2024 01:01:15 +0000 (17:01 -0800)
commit0ca22723e3ffe0d539c5d72603dded8fe6924a89
tree118d5054febf05a33118797773b914a74133befa
parent997f0ecb11da15602a3d34e10f9ca8418db794d0
hugetlb: move vm_fault declaration to the top of hugetlb_fault()

hugetlb_fault() currently defines a vm_fault to pass to the generic
handle_userfault() function.  We can move this definition to the top of
hugetlb_fault() so that it can be used throughout the rest of the hugetlb
fault path.

This will help cleanup a number of excess variables and function arguments
throughout the stack.  Also, since vm_fault already has space to store the
page offset, use that instead and get rid of idx.

Link: https://lkml.kernel.org/r/20240221234732.187629-3-vishal.moola@gmail.com
Signed-off-by: Vishal Moola (Oracle) <vishal.moola@gmail.com>
Reviewed-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Cc: Muchun Song <muchun.song@linux.dev>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
mm/hugetlb.c