[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAEvNRgFmq8DP_=V7mrY8qza3i9h4-Bn0OWt72iDj6mELu+BiZg@mail.gmail.com>
Date: Fri, 23 Jan 2026 16:07:57 -0800
From: Ackerley Tng <ackerleytng@...gle.com>
To: kvm@...r.kernel.org, linux-mm@...ck.org, linux-kernel@...r.kernel.org,
x86@...nel.org, linux-fsdevel@...r.kernel.org
Cc: david@...nel.org, fvdl@...gle.com, ira.weiny@...el.com,
jthoughton@...gle.com, michael.roth@....com, pankaj.gupta@....com,
rick.p.edgecombe@...el.com, seanjc@...gle.com, vannapurve@...gle.com,
yan.y.zhao@...el.com, "Kalyazin, Nikita" <kalyazin@...zon.co.uk>
Subject: Re: [RFC PATCH v2 00/51] 1G page support for guest_memfd
Ackerley Tng <ackerleytng@...gle.com> writes:
Re-using this thread to collect discussions related to guest_memfd
HugeTLB support, also trimmed cc list.
Here's the latest public version Vishal and I have:
https://github.com/googleprodkernel/linux-cc/tree/wip-gmem-conversions-hugetlb-restructuring-12-08-25
On the guest_memfd call on 2026-01-22, Michael found another bug to do
with multiple threads trying to allocate within the same huge page at
the same time.
The fix we're using to make progress is to use hugetlb_fault_mutex_lock.
unsigned int gmem_hugetlb_mapping_index_lock(struct address_space *mapping,
pgoff_t index, u8 page_order)
{
pgoff_t index_floor = round_down(index, 1ULL << page_order);
return hugetlb_fault_mutex_lock(mapping, index_floor);
}
void gmem_hugetlb_mapping_index_unlock(unsigned int hash)
{
hugetlb_fault_mutex_unlock(hash);
}
and then
static struct folio *kvm_gmem_get_folio(struct inode *inode, pgoff_t index)
{
... declarations ...
if (gmem_is_hugetlb(gi->flags))
lock_id = gmem_hugetlb_mapping_index_lock(mapping, index, gi->page_order);
... and this right at the end ...
if (gmem_is_hugetlb(gi->flags))
gmem_hugetlb_mapping_index_unlock(lock_id);
}
Yan also found some bugs (thanks!) and there's a discussion at [*].
[*] https://lore.kernel.org/all/CAEvNRgGG+xYhsz62foOrTeAxUCYxpCKCJnNgTAMYMV=w2eq+6Q@mail.gmail.com/
Powered by blists - more mailing lists