On Tue, Dec 1, 2026 at 9:16 AM Qiliang Yuan qiliang.yuan@linux.dev wrote:
udmabuf maps the ranges of a buffer that are backed by huge pages with PMDs, provided the mapping covers whole PMDs at an aligned address.
The existing tests of huge page backed buffers only map a few pages, so they never get a PMD mapping or check what is read through one.
Map a udmabuf of 8 huge pages, sized from hpage_pmd_size and the hugetlb page size so that it also fits 16 KiB and 64 KiB base pages, and read back what was written to the memfd, with a different pattern in each huge page: through a mapping of the whole buffer, which must be PMD aligned for a 64-bit task when THP support is built in, through a mapping at an unaligned offset, from a forked child that inherits the mapping of the whole buffer, through a buffer that starts one page into the memfd so that only PTEs can map it, and next to a mapped PMD after THP was disabled for the mapping with MADV_NOHUGEPAGE.
Signed-off-by: Qiliang Yuan qiliang.yuan@linux.dev
Reviewed-by: T.J. Mercier tjmercier@google.com