Re: [RFC PATCH 2/3] hugetlb: do not update address in huge_pmd_unshare

From: Baolin Wang
Date: Mon May 30 2022 - 06:14:34 EST




On 5/28/2022 6:58 AM, Mike Kravetz wrote:
As an optimization for loops sequentially processing hugetlb address
ranges, huge_pmd_unshare would update a passed address if it unshared a
pmd. Updating a loop control variable outside the loop like this is
generally a bad idea. These loops are now using hugetlb_mask_last_hp
to optimize scanning when non-present ptes are discovered. The same
can be done when huge_pmd_unshare returns 1 indicating a pmd was
unshared.

Remove address update from huge_pmd_unshare. Change the passed argument
type and update all callers. In loops sequentially processing addresses
use hugetlb_mask_last_hp to update address if pmd is unshared.

Signed-off-by: Mike Kravetz <mike.kravetz@xxxxxxxxxx>

LGTM. Please feel free to add:
Reviewed-by: Baolin Wang <baolin.wang@xxxxxxxxxxxxxxxxx>