Re: [PATCH v2 6/9] hugetlb: add vma based lock for pmd sharing

From: Mike Kravetz
Date: Thu Sep 15 2022 - 16:25:56 EST


On 09/14/22 15:18, Mike Kravetz wrote:
> Allocate a new hugetlb_vma_lock structure and hang off vm_private_data
> for synchronization use by vmas that could be involved in pmd sharing.
> This data structure contains a rw semaphore that is the primary tool
> used for synchronization.
>
> This new structure is ref counted, so that it can exist when NOT attached
> to a vma. This is only helpful in resolving lock ordering issues where
> code may need to obtain the vma_lock while there are no guarantees the
> vma may go away. By obtaining a ref on the structure, it can be
> guaranteed that at least the rw semaphore will not go away.
>
> Only add infrastructure for the new lock here. Actual use will be added
> in subsequent patches.
>
> Signed-off-by: Mike Kravetz <mike.kravetz@xxxxxxxxxx>
> ---
> include/linux/hugetlb.h | 43 ++++++++-
> kernel/fork.c | 6 +-
> mm/hugetlb.c | 202 ++++++++++++++++++++++++++++++++++++----
> mm/rmap.c | 8 +-
> 4 files changed, 235 insertions(+), 24 deletions(-)

Reviewers - FYI, the following was added to address a build issue caused
by this patch.