Re: [PATCH] mm/hugetlb: stop hashing address_space pointers for fault mutexes
From: Oscar Salvador (SUSE)
Date: Mon Nov 30 2026 - 05:20:04 EST
On Sun, Nov 29, 2026 at 11:35:06AM +0100, David Hildenbrand (Arm) wrote:
> On 11/26/26 12:20, David Hildenbrand (Arm) wrote:
> > On 11/25/26 07:15, Zhengchuan Liang wrote:
> >> --- a/mm/hugetlb.c
> >> +++ b/mm/hugetlb.c
> >> @@ -6091,13 +6091,8 @@ static vm_fault_t hugetlb_no_page(struct address_space *mapping,
> >> #ifdef CONFIG_SMP
> >> u32 hugetlb_fault_mutex_hash(struct address_space *mapping, pgoff_t idx)
> >> {
> >> - unsigned long key[2];
> >> - u32 hash;
> >> -
> >> - key[0] = (unsigned long) mapping;
> >> - key[1] = idx;
> >> -
> >> - hash = jhash2((u32 *)&key, sizeof(key)/(sizeof(u32)), 0);
> >> + u32 seed = HUGETLBFS_I(mapping->host)->fault_mutex_hash_seed;
> >> + u32 hash = jhash2((u32 *)&idx, sizeof(idx) / sizeof(u32), seed);
> >
> > Both can be const.
>
> Can you fix that up and add my
>
> Reviewed-by: David Hildenbrand (Arm) <david@xxxxxxxxxx>
>
> ... and add some more details about what we leak and how you reproduced that?
>
> ... and then resend? Maybe that makes it easier to get hugetlb maintainer's
> attention :)
Sorry, lots of hugetlb fixes lately
Current version with the const fixups LGTM, I will add my ack later.
Just wanted to ask about the suggestion of using the inode number. Does not that
provide enough randomness?
--
Oscar Salvador
SUSE Labs