Re: [PATCH 1/2] maple_tree: Fix status setup on restore to active

From: Wei Yang
Date: Tue Jun 24 2025 - 21:12:10 EST


On Tue, Jun 24, 2025 at 11:48:22AM -0400, Liam R. Howlett wrote:
>During the initial call with a maple state, an error status may be set
>before a valid node is populated into the maple state node. Subsequent
>calls with the maple state may restore the state into an active state
>with no node set. This was masked by the mas_walk() always resetting
>the status to ma_state and result in an extra walk in this rare
^^^

Nit

s/ma_state/ma_start/

>scenario.
>
>Don't restore the state to active unless there is a value in the structs
>node. This also allows mas_walk() to be fixed to use the active state
>without exposing an issue.
>
>User visible results are marginal performance improvements when an
>active state can be restored and used instead of rewalking the tree.
>
>Stable is not Cc'ed because the existing code is stable and the
>performance gains are not worth the risk.
>
>Link: https://lore.kernel.org/all/20250611011253.19515-1-richard.weiyang@xxxxxxxxx/
>Link: https://lore.kernel.org/all/20250407231354.11771-1-richard.weiyang@xxxxxxxxx/
>Link: https://lore.kernel.org/all/202506191556.6bfc7b93-lkp@xxxxxxxxx/
>Fixes: a8091f039c1e ("maple_tree: add MAS_UNDERFLOW and MAS_OVERFLOW states")
>Reported-by: Wei Yang <richard.weiyang@xxxxxxxxx>
>Reported-by: kernel test robot <oliver.sang@xxxxxxxxx>
>Closes: https://lore.kernel.org/oe-lkp/202506191556.6bfc7b93-lkp@xxxxxxxxx
>Signed-off-by: Liam R. Howlett <Liam.Howlett@xxxxxxxxxx>

Reviewed-by: Wei Yang <richard.weiyang@xxxxxxxxx>

--
Wei Yang
Help you, Help me