xarray-add-xas_try_split-to-split-a-multi-index-entry.patch removed from -mm tree
The quilt patch titled
Subject: xarray: add xas_try_split() to split a multi-index entry
has been removed from the -mm tree. Its filename was
xarray-add-xas_try_split-to-split-a-multi-index-entry.patch
This patch was dropped because it was merged into the mm-stable branch of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
------------------------------------------------------
From: Zi Yan <[email protected]>
Subject: xarray: add xas_try_split() to split a multi-index entry
Date: Fri, 7 Mar 2025 12:39:54 -0500
Patch series "Buddy allocator like (or non-uniform) folio split", v10.
This patchset adds a new buddy allocator like (or non-uniform) large folio split from a order-n folio to order-m with m < n. It reduces
1. the total number of after-split folios from 2^(n-m) to n-m+1;
2. the amount of memory needed for multi-index xarray split from 2^(n/6-m/6) to n/6-m/6, assuming XA_CHUNK_SHIFT=6;
3. keep more large folios after a split from all order-m folios to order-(n-1) to order-m folios.
For example, to split an order-9 to order-0, folio split generates 10 (or 11 for anonymous memory) folios instead of 512, allocates 1 xa_node instead of 8, and leaves 1 order-8, 1 order-7, ..., 1 order-1 and 2 order-0 folios (or 4 order-0 for anonymous memory) instead of 512 order-0 folios.
Instead of duplicating existing split_huge_page*() code, __folio_split() is introduced as the shared backend code for both split_huge_page_to_list_to_order() and folio_split(). __folio_split() can support both uniform split and buddy allocator like (or non-uniform) split. All existing split_huge_page*() users can be gradually converted to use folio_split() if possible. In this patchset, I converted truncate_inode_partial_folio() to use folio_split().
xfstests quick group passed for both tmpfs and xfs. I also semi-replicated Hugh's test[12] and ran it without any issue for almost 24 hours.
This patch (of 8):
A preparation patch for non-uniform folio split, which always split a folio into half iteratively, and minimal xarray entry split.
Currently, xas_split_alloc() and xas_split() always split all slots from a multi-index entry. They cost the same number of xa_node as the to-be-split slots. For example, to split an order-9 entry, which takes 2^(9-6)=8 slots, assuming XA_CHUNK_SHIFT is 6 (!CONFIG_BASE_SMALL), 8 xa_node are needed. Instead xas_try_split() is intended to be used iteratively to split the order-9 entry into 2 order-8 entries, then split one order-8 entry, based on the given index, to 2 order-7 entries, ..., and split one order-1 entry to 2 order-0 entries. When splitting the order-6 entry and a new xa_node is needed, xas_try_split() will try to allocate one if possible. As a result, xas_try_split() would only need 1 xa_node instead of 8.
When a new xa_node is needed during the split, xas_try_split() can try to allocate one but no more. -ENOMEM will be return if a node cannot be allocated. -EINVAL will be return if a sibling node is split or cascade split happens, where two or more new nodes are needed, and these are not supported by xas_try_split().
xas_split_alloc() and xas_split() split an order-9 to order-0:
---------------------------------
| | | | | | | | |
| 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 |
| | | | | | | | |
---------------------------------
| | | |
------- --- --- -------
| | ... | |
V V V V
----------- ----------- ----------- -----------
| xa_node | | xa_node | ... | xa_node | | xa_node |
----------- ----------- ----------- -----------xas_try_split() splits an order-9 to order-0:
---------------------------------
| | | | | | | | |
| 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 |
| | | | | | | | |
---------------------------------
|
|
V-----------
| xa_node |
-----------
---
Documentation/core-api/xarray.rst | 14 ++ include/linux/xarray.h | 6 + lib/test_xarray.c | 52 +++++++++++ lib/xarray.c | 132 +++++++++++++++++++++++++--- tools/testing/radix-tree/Makefile | 1 5 files changed, 192 insertions(+), 13 deletions(-)
Documentation/core-api/xarray.rst renamed from Documentation/core-api/xarray.rst~xarray-add-xas_try_split-to-split-a-multi-index-entry +13 -1
@@ -489,7 +489,19 @@ Storing ``NULL`` into any index of a mul entry at every index to ``NULL`` and dissolve the tie. A multi-index entry can be split into entries occupying smaller ranges by calling xas_split_alloc() without the xa_lock held, followed by taking the lock -and calling xas_split(). +and calling xas_split() or calling xas_try_split() with xa_lock. The +difference between xas_split_alloc()+xas_split() and xas_try_alloc() is +that xas_split_alloc() + xas_split() split the entry from the original +order to the new order in one shot uniformly, whereas xas_try_split() +iteratively splits the entry containing the index non-uniformly. +For example, to split an order-9 entry, which takes 2^(9-6)=8 slots, +assuming ``XA_CHUNK_SHIFT`` is 6, xas_split_alloc() + xas_split() need +8 xa_node. xas_try_split() splits the order-9 entry into +2 order-8 entries, then split one order-8 entry, based on the given index, +to 2 order-7 entries, ..., and split one order-1 entry to 2 order-0 entries. +When splitting the order-6 entry and a new xa_node is needed, xas_try_split() +will try to allocate one if possible. As a result, xas_try_split() would only +need 1 xa_node instead of 8. Functions and structures ========================
include/linux/xarray.h renamed from include/linux/xarray.h~xarray-add-xas_try_split-to-split-a-multi-index-entry +6 -0
@@ -1555,6 +1555,7 @@ int xa_get_order(struct xarray *, unsignint xas_get_order (struct xa_state *xas);void xas_split (struct xa_state *,void *entry,unsigned int order);void xas_split_alloc (struct xa_state *,void *entry,unsigned int order,gfp_t ); +void xas_try_split (struct xa_state *xas,void *entry,unsigned int order);#else static inline int xa_get_order (struct xarray *xa,unsigned long index) {
@@ -1576,6 +1577,11 @@ static inline void xas_split_alloc(struc unsigned int order, gfp_t gfp) { } + +static inline void xas_try_split (struct xa_state *xas,void *entry, +unsigned int order) +{ +}#endif /**
lib/test_xarray.c renamed from lib/test_xarray.c~xarray-add-xas_try_split-to-split-a-multi-index-entry +52 -0
64 lines not on this page · raw message
lib/xarray.c renamed from lib/xarray.c~xarray-add-xas_try_split-to-split-a-multi-index-entry +120 -12
167 lines not on this page · raw message
tools/testing/radix-tree/Makefile renamed from tools/testing/radix-tree/Makefile~xarray-add-xas_try_split-to-split-a-multi-index-entry +1 -0
@@ -14,6 +14,7 @@ include ../shared/shared.mk main: $(OFILES) +xarray.o: ../../../lib/test_xarray.c idr-test.o: ../../../lib/test_ida.c idr-test: idr-test.o $(CORE_OFILES)
_
Patches currently in -mm which might be from [email protected] are