[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20251117224701.1279139-1-ackerleytng@google.com>
Date: Mon, 17 Nov 2025 14:46:57 -0800
From: Ackerley Tng <ackerleytng@...gle.com>
To: willy@...radead.org, akpm@...ux-foundation.org,
linux-fsdevel@...r.kernel.org, linux-mm@...ck.org,
linux-kernel@...r.kernel.org
Cc: david@...hat.com, michael.roth@....com, vannapurve@...gle.com,
Ackerley Tng <ackerleytng@...gle.com>
Subject: [RFC PATCH 0/4] Extend xas_split* to support splitting arbitrarily
large entries
guest_memfd is planning to store huge pages in the filemap, and
guest_memfd's use of huge pages involves splitting of huge pages into
individual pages. Splitting of huge pages also involves splitting of
the filemap entries for the pages being split.
To summarize the context of how these patches will be used,
+ guest_memfd stores huge pages (up to 1G pages) in the filemap.
+ During folio splitting, guest_memfd needs split the folios, and
approaches that by first splitting the filemap (XArray) entries that
the folio occupies, and then splitting the struct folios themselves.
+ Splitting from a 1G to 4K folio requires splitting an entry in a
shift-18 XArray node to a shift-0 node in the xarray, which goes
beyond 2 levels of XArray nodes, and is currently not supported.
This work-in-progress series at [1] shows the context of how these
patches for XArray entry splitting will be used.
[1] https://github.com/googleprodkernel/linux-cc/tree/wip-gmem-conversions-hugetlb-restructuring
This patch series extends xas_split_alloc() to allocate enough nodes
for splitting an XArray node beyond 2 levels, and extends xas_split()
to use the allocated nodes in a split beyond 2 levels.
Merging of XArray entries can be performed with xa_store_order() at
the original order, and hence no change to the XArray library is
required.
xas_destroy() cleans up any allocated and unused nodes in struct
xa_state, and so no further changes are necessary there.
Please let me know
+ If this extension is welcome
+ Your thoughts on the approach: is it too many nodes to allocate at
once? Would a recursive implementation be preferred?
+ If there are any bugs, particularly around how xas_split() interacts
with LRU
Thank you!
Ackerley Tng (4):
XArray: Initialize nodes while splitting instead of while allocating
XArray: Update xas_split_alloc() to allocate enough nodes to split
large entries
XArray: Support splitting for arbitrarily large entries
XArray: test: Increase split order test range in check_split()
lib/test_xarray.c | 6 +-
lib/xarray.c | 210 ++++++++++++++++++++++++++++++++++------------
2 files changed, 162 insertions(+), 54 deletions(-)
--
2.52.0.rc1.455.g30608eb744-goog
Powered by blists - more mailing lists