<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel/linux.git/lib/maple_tree.c, branch v7.3-rc1</title>
<subtitle>Linux kernel stable tree (mirror)</subtitle>
<id>https://git.radix-linux.su/kernel/linux.git/atom?h=v7.3-rc1</id>
<link rel='self' href='https://git.radix-linux.su/kernel/linux.git/atom?h=v7.3-rc1'/>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/'/>
<updated>2026-08-25T01:43:32+00:00</updated>
<entry>
<title>maple_tree: add helper mas_make_walkable()</title>
<updated>2026-08-25T01:43:32+00:00</updated>
<author>
<name>Liam R. Howlett (Oracle)</name>
<email>liam@infradead.org</email>
</author>
<published>2026-08-21T19:26:27+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=d17c749d32b2d6d16981ac003ff1cae85860e819'/>
<id>urn:sha1:d17c749d32b2d6d16981ac003ff1cae85860e819</id>
<content type='text'>
A check in mas_walk() was incorrect and caused inefficient use of the
maple state.  The same issue existed in mas_erase(), but was left unfixed.
Making a helper function is the obvious answer.

Link: https://lore.kernel.org/20260821192627.4085470-20-liam@infradead.org
Signed-off-by: Liam R. Howlett (Oracle) &lt;liam@infradead.org&gt;
Cc: Boqun Feng &lt;boqun.feng@gmail.com&gt;
Cc: Breno Leitao &lt;leitao@debian.org&gt;
Cc: Chris Mason &lt;clm@meta.com&gt;
Cc: Chuck Lever &lt;cel@kernel.org&gt;
Cc: Ingo Molnar &lt;mingo@redhat.com&gt;
Cc: Jason Gunthorpe &lt;jgg@ziepe.ca&gt;
Cc: Joe Perches &lt;joe@perches.com&gt;
Cc: Peter Zijlstra &lt;peterz@infradead.org&gt;
Cc: Rik van Riel &lt;riel@surriel.com&gt;
Cc: Waiman Long &lt;longman@redhat.com&gt;
Cc: Will Deacon &lt;will@kernel.org&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
</content>
</entry>
<entry>
<title>maple_tree: avoid extra gap calculation</title>
<updated>2026-08-25T01:43:32+00:00</updated>
<author>
<name>Liam R. Howlett (Oracle)</name>
<email>liam@infradead.org</email>
</author>
<published>2026-08-21T19:26:26+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=4e4fe9d7271edf83ee4475e92b96aa89bd2ccd7e'/>
<id>urn:sha1:4e4fe9d7271edf83ee4475e92b96aa89bd2ccd7e</id>
<content type='text'>
Prior to ending the ascension loop of larger operations like split,
rebalance, and spanning store the gap in the node had been calculated. 
Once the node is inserted into the tree, the gap is recalculated in
mas_update_gap().  This can be avoided by creating a helper for
mas_update_gap() that accepts the known gap value, which reduces the
operations required for gap updating path.

Link: https://lore.kernel.org/20260821192627.4085470-19-liam@infradead.org
Signed-off-by: Liam R. Howlett (Oracle) &lt;liam@infradead.org&gt;
Cc: Boqun Feng &lt;boqun.feng@gmail.com&gt;
Cc: Breno Leitao &lt;leitao@debian.org&gt;
Cc: Chris Mason &lt;clm@meta.com&gt;
Cc: Chuck Lever &lt;cel@kernel.org&gt;
Cc: Ingo Molnar &lt;mingo@redhat.com&gt;
Cc: Jason Gunthorpe &lt;jgg@ziepe.ca&gt;
Cc: Joe Perches &lt;joe@perches.com&gt;
Cc: Peter Zijlstra &lt;peterz@infradead.org&gt;
Cc: Rik van Riel &lt;riel@surriel.com&gt;
Cc: Waiman Long &lt;longman@redhat.com&gt;
Cc: Will Deacon &lt;will@kernel.org&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
</content>
</entry>
<entry>
<title>maple_tree: avoid mas_erase() and mtree_erase() failures</title>
<updated>2026-08-25T01:43:31+00:00</updated>
<author>
<name>Liam R. Howlett (Oracle)</name>
<email>liam@infradead.org</email>
</author>
<published>2026-08-21T19:26:22+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=f1681380b5f928e147954d87d875f57a25df189c'/>
<id>urn:sha1:f1681380b5f928e147954d87d875f57a25df189c</id>
<content type='text'>
Failures to remove entries using the two APIs to erase the entries may
result in allocation failures.  The failures may go unnoticed and an
unexpected entry may remain.  Instead, fall back to retrying with
GFP_KERNEL | __GFP_NOFAIL so that the entry will be removed.

Link: https://lore.kernel.org/20260821192627.4085470-15-liam@infradead.org
Signed-off-by: Liam R. Howlett (Oracle) &lt;liam@infradead.org&gt;
Cc: Rik van Riel &lt;riel@surriel.com&gt;
Cc: Jason Gunthorpe &lt;jgg@ziepe.ca&gt;
Cc: Boqun Feng &lt;boqun.feng@gmail.com&gt;
Cc: Breno Leitao &lt;leitao@debian.org&gt;
Cc: Chris Mason &lt;clm@meta.com&gt;
Cc: Chuck Lever &lt;cel@kernel.org&gt;
Cc: Ingo Molnar &lt;mingo@redhat.com&gt;
Cc: Joe Perches &lt;joe@perches.com&gt;
Cc: Peter Zijlstra &lt;peterz@infradead.org&gt;
Cc: Waiman Long &lt;longman@redhat.com&gt;
Cc: Will Deacon &lt;will@kernel.org&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
</content>
</entry>
<entry>
<title>maple_tree: document that erase may use GFP_KERNEL for allocations</title>
<updated>2026-08-25T01:43:31+00:00</updated>
<author>
<name>Liam R. Howlett (Oracle)</name>
<email>liam@infradead.org</email>
</author>
<published>2026-08-21T19:26:21+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=3f06ef1f34a7ee3b77ee03c13a0c50db8fd3c536'/>
<id>urn:sha1:3f06ef1f34a7ee3b77ee03c13a0c50db8fd3c536</id>
<content type='text'>
State that the mas_erase() and mtree_erase() functions may use GFP_KERNEL
on allocation retry.  Don't just depend on people reading the
documentation by adding a check that will warn of the use.

Link: https://lore.kernel.org/20260821192627.4085470-14-liam@infradead.org
Signed-off-by: Liam R. Howlett (Oracle) &lt;liam@infradead.org&gt;
Reviewed-by: Rik van Riel &lt;riel@surriel.com&gt;
Cc: Jason Gunthorpe &lt;jgg@ziepe.ca&gt;
Cc: Boqun Feng &lt;boqun.feng@gmail.com&gt;
Cc: Breno Leitao &lt;leitao@debian.org&gt;
Cc: Chris Mason &lt;clm@meta.com&gt;
Cc: Chuck Lever &lt;cel@kernel.org&gt;
Cc: Ingo Molnar &lt;mingo@redhat.com&gt;
Cc: Joe Perches &lt;joe@perches.com&gt;
Cc: Peter Zijlstra &lt;peterz@infradead.org&gt;
Cc: Waiman Long &lt;longman@redhat.com&gt;
Cc: Will Deacon &lt;will@kernel.org&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
</content>
</entry>
<entry>
<title>maple_tree: catch race in mas_alloc_cyclic()</title>
<updated>2026-08-25T01:43:30+00:00</updated>
<author>
<name>Liam R. Howlett (Oracle)</name>
<email>liam@infradead.org</email>
</author>
<published>2026-08-21T19:26:20+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=35f1342e5b893a740eff2ef9ab337bfaa63ab76d'/>
<id>urn:sha1:35f1342e5b893a740eff2ef9ab337bfaa63ab76d</id>
<content type='text'>
If mas_alloc_cyclic() is called during a low memory situation, it is
possible the lock may be dropped so reclaim can occur.  There is a window
where some other task may allocate the same id and cause the mas_insert()
to fail with -EEXIST.  In this scenario the function will return -EEXIST,
which is not expected.

Modifying the retry on mas_nomem() to re-search for a slot means that any
race with other writes will not matter as the lock will be held between
finding the index and writing the index.

Moving the flag logic avoids cases where the flag is modified on drop
lock/reacquire or when the write fails after clearing the flag.

No existing users are exposed to this issue.

Link: https://lore.kernel.org/20260821192627.4085470-13-liam@infradead.org
Fixes: 9b6713cc7522 ("maple_tree: Add mtree_alloc_cyclic()")
Signed-off-by: Liam R. Howlett (Oracle) &lt;liam@infradead.org&gt;
Reported-by: Chris Mason &lt;clm@meta.com&gt;
Reviewed-by: Chuck Lever &lt;cel@kernel.org&gt;
Cc: Boqun Feng &lt;boqun.feng@gmail.com&gt;
Cc: Breno Leitao &lt;leitao@debian.org&gt;
Cc: Ingo Molnar &lt;mingo@redhat.com&gt;
Cc: Jason Gunthorpe &lt;jgg@ziepe.ca&gt;
Cc: Joe Perches &lt;joe@perches.com&gt;
Cc: Peter Zijlstra &lt;peterz@infradead.org&gt;
Cc: Rik van Riel &lt;riel@surriel.com&gt;
Cc: Waiman Long &lt;longman@redhat.com&gt;
Cc: Will Deacon &lt;will@kernel.org&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
</content>
</entry>
<entry>
<title>maple_tree: add bulk parent set helper</title>
<updated>2026-08-25T01:43:30+00:00</updated>
<author>
<name>Liam R. Howlett (Oracle)</name>
<email>liam@infradead.org</email>
</author>
<published>2026-08-21T19:26:19+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=cf1f9bae5dac2082db374a0acfe41e55aaf909e2'/>
<id>urn:sha1:cf1f9bae5dac2082db374a0acfe41e55aaf909e2</id>
<content type='text'>
Instead of calculating the parent pointer each time for a child, cache the
majority of the parent pointer and only change the slot per child.

Drop the mas_set_parent() function since the last user has been removed.

Testing on a tree containing 2048 entries of height 4 had an increased
gain of 3.51% on nodes tracking gaps.

Link: https://lore.kernel.org/20260821192627.4085470-12-liam@infradead.org
Signed-off-by: Liam R. Howlett (Oracle) &lt;liam@infradead.org&gt;
Cc: Boqun Feng &lt;boqun.feng@gmail.com&gt;
Cc: Breno Leitao &lt;leitao@debian.org&gt;
Cc: Chris Mason &lt;clm@meta.com&gt;
Cc: Chuck Lever &lt;cel@kernel.org&gt;
Cc: Ingo Molnar &lt;mingo@redhat.com&gt;
Cc: Jason Gunthorpe &lt;jgg@ziepe.ca&gt;
Cc: Joe Perches &lt;joe@perches.com&gt;
Cc: Peter Zijlstra &lt;peterz@infradead.org&gt;
Cc: Rik van Riel &lt;riel@surriel.com&gt;
Cc: Waiman Long &lt;longman@redhat.com&gt;
Cc: Will Deacon &lt;will@kernel.org&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
</content>
</entry>
<entry>
<title>maple_tree: micro optimisation of mas_wr_store_type()</title>
<updated>2026-08-25T01:43:30+00:00</updated>
<author>
<name>Liam R. Howlett (Oracle)</name>
<email>liam@infradead.org</email>
</author>
<published>2026-08-21T19:26:18+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=f0a3892cd726909b0e9c30ec9b5b05f1f63a5fbf'/>
<id>urn:sha1:f0a3892cd726909b0e9c30ec9b5b05f1f63a5fbf</id>
<content type='text'>
Use three new local booleans instead of reading other structures.  This
has shown an increase of 0.62% on a 2048 entry tree of height 4.

Link: https://lore.kernel.org/20260821192627.4085470-11-liam@infradead.org
Signed-off-by: Liam R. Howlett (Oracle) &lt;liam@infradead.org&gt;
Cc: Boqun Feng &lt;boqun.feng@gmail.com&gt;
Cc: Breno Leitao &lt;leitao@debian.org&gt;
Cc: Chris Mason &lt;clm@meta.com&gt;
Cc: Chuck Lever &lt;cel@kernel.org&gt;
Cc: Ingo Molnar &lt;mingo@redhat.com&gt;
Cc: Jason Gunthorpe &lt;jgg@ziepe.ca&gt;
Cc: Joe Perches &lt;joe@perches.com&gt;
Cc: Peter Zijlstra &lt;peterz@infradead.org&gt;
Cc: Rik van Riel &lt;riel@surriel.com&gt;
Cc: Waiman Long &lt;longman@redhat.com&gt;
Cc: Will Deacon &lt;will@kernel.org&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
</content>
</entry>
<entry>
<title>maple_tree: optimise mas_wr_node_store() when not in rcu mode</title>
<updated>2026-08-25T01:43:30+00:00</updated>
<author>
<name>Liam R. Howlett (Oracle)</name>
<email>liam@infradead.org</email>
</author>
<published>2026-08-21T19:26:17+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=88f87f881240da3f09541d8232255376778b8f1c'/>
<id>urn:sha1:88f87f881240da3f09541d8232255376778b8f1c</id>
<content type='text'>
Clearing the entire node on the stack is unnecessary since most of the
node will be overwritten anyways.  Just clear what isn't used after the
data is in place.

Benchmarking shows a speedup of 0.67% on a height 4 tree with 2048
entries.

Link: https://lore.kernel.org/20260821192627.4085470-10-liam@infradead.org
Signed-off-by: Liam R. Howlett (Oracle) &lt;liam@infradead.org&gt;
Cc: Boqun Feng &lt;boqun.feng@gmail.com&gt;
Cc: Breno Leitao &lt;leitao@debian.org&gt;
Cc: Chris Mason &lt;clm@meta.com&gt;
Cc: Chuck Lever &lt;cel@kernel.org&gt;
Cc: Ingo Molnar &lt;mingo@redhat.com&gt;
Cc: Jason Gunthorpe &lt;jgg@ziepe.ca&gt;
Cc: Joe Perches &lt;joe@perches.com&gt;
Cc: Peter Zijlstra &lt;peterz@infradead.org&gt;
Cc: Rik van Riel &lt;riel@surriel.com&gt;
Cc: Waiman Long &lt;longman@redhat.com&gt;
Cc: Will Deacon &lt;will@kernel.org&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
</content>
</entry>
<entry>
<title>maple_tree: use prefetched value in mas_wr_store_type()</title>
<updated>2026-08-25T01:43:29+00:00</updated>
<author>
<name>Liam R. Howlett (Oracle)</name>
<email>liam@infradead.org</email>
</author>
<published>2026-08-21T19:26:16+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=4bd59d5bc2c8f3e7e1bd62f3a5029471a6b531bb'/>
<id>urn:sha1:4bd59d5bc2c8f3e7e1bd62f3a5029471a6b531bb</id>
<content type='text'>
The slot contents exist in wr_mas-&gt;content, which has less overhead than
reading the slot again.

Link: https://lore.kernel.org/20260821192627.4085470-9-liam@infradead.org
Signed-off-by: Liam R. Howlett (Oracle) &lt;liam@infradead.org&gt;
Cc: Boqun Feng &lt;boqun.feng@gmail.com&gt;
Cc: Breno Leitao &lt;leitao@debian.org&gt;
Cc: Chris Mason &lt;clm@meta.com&gt;
Cc: Chuck Lever &lt;cel@kernel.org&gt;
Cc: Ingo Molnar &lt;mingo@redhat.com&gt;
Cc: Jason Gunthorpe &lt;jgg@ziepe.ca&gt;
Cc: Joe Perches &lt;joe@perches.com&gt;
Cc: Peter Zijlstra &lt;peterz@infradead.org&gt;
Cc: Rik van Riel &lt;riel@surriel.com&gt;
Cc: Waiman Long &lt;longman@redhat.com&gt;
Cc: Will Deacon &lt;will@kernel.org&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
</content>
</entry>
<entry>
<title>maple_tree: clarify comments on mas_nomem()</title>
<updated>2026-08-25T01:43:29+00:00</updated>
<author>
<name>Liam R. Howlett (Oracle)</name>
<email>liam@infradead.org</email>
</author>
<published>2026-08-21T19:26:15+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=7d1e34352727cf1073eccbacd13fac075defc7a4'/>
<id>urn:sha1:7d1e34352727cf1073eccbacd13fac075defc7a4</id>
<content type='text'>
When an allocation completely fails, the return is false.  If the
allocation succeeds or partially succeeds, return true to indicate a retry
of the operation.  Note that since the lock may have been dropped, the
operation is retried from the start - including potentially allocating
more memory.

Link: https://lore.kernel.org/20260821192627.4085470-8-liam@infradead.org
Signed-off-by: Liam R. Howlett (Oracle) &lt;liam@infradead.org&gt;
Cc: Boqun Feng &lt;boqun.feng@gmail.com&gt;
Cc: Breno Leitao &lt;leitao@debian.org&gt;
Cc: Chris Mason &lt;clm@meta.com&gt;
Cc: Chuck Lever &lt;cel@kernel.org&gt;
Cc: Ingo Molnar &lt;mingo@redhat.com&gt;
Cc: Jason Gunthorpe &lt;jgg@ziepe.ca&gt;
Cc: Joe Perches &lt;joe@perches.com&gt;
Cc: Peter Zijlstra &lt;peterz@infradead.org&gt;
Cc: Rik van Riel &lt;riel@surriel.com&gt;
Cc: Waiman Long &lt;longman@redhat.com&gt;
Cc: Will Deacon &lt;will@kernel.org&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
</content>
</entry>
</feed>
