diff --git a/mm/huge_memory.c b/mm/huge_memory.c index 91442a9a87f64f..feee44c3bb4789 100644 --- a/mm/huge_memory.c +++ b/mm/huge_memory.c @@ -2451,6 +2451,9 @@ static void collapse_huge_page(struct mm_struct *mm, goto out_nolock; } + swap = get_mm_counter(mm, MM_SWAPENTS); + curr_allocstall = sum_vm_event(ALLOCSTALL); + /* * Prevent all access to pagetables with the exception of * gup_fast later hanlded by the ptep_clear_flush and the VM @@ -2483,8 +2486,6 @@ static void collapse_huge_page(struct mm_struct *mm, goto out; } - swap = get_mm_counter(mm, MM_SWAPENTS); - curr_allocstall = sum_vm_event(ALLOCSTALL); /* * Don't perform swapin readahead when the system is under pressure, * to avoid unnecessary resource consumption.