Re: [PATCH 2/2] hugetlb: use same fault hash key for shared and private mappings

From: Mike Kravetz
Date: Fri Mar 08 2019 - 18:09:23 EST


On 3/8/19 2:48 PM, Mike Kravetz wrote:
> mm/hugetlb.c | 9 ++-------
> 1 file changed, 2 insertions(+), 7 deletions(-)
>
> diff --git a/mm/hugetlb.c b/mm/hugetlb.c
> index 64ef640126cd..0527732c71f0 100644
> --- a/mm/hugetlb.c
> +++ b/mm/hugetlb.c
> @@ -3904,13 +3904,8 @@ u32 hugetlb_fault_mutex_hash(struct hstate *h, struct mm_struct *mm,
> unsigned long key[2];
> u32 hash;
>
> - if (vma->vm_flags & VM_SHARED) {
> - key[0] = (unsigned long) mapping;
> - key[1] = idx;
> - } else {
> - key[0] = (unsigned long) mm;
> - key[1] = address >> huge_page_shift(h);
> - }
> + key[0] = (unsigned long) mapping;
> + key[1] = idx;
>
> hash = jhash2((u32 *)&key, sizeof(key)/sizeof(u32), 0);

Duh!

If we no longer use mm and address they can be dropped from the function
arguments and all callers. Before doing that, let's see if there is any
objection to using the same key for shared and private mappings.

--
Mike Kravetz