summaryrefslogtreecommitdiff
path: root/scripts/Makefile.thinlto
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2026-10-11 11:35:18 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2026-10-13 09:44:51 -0700
commitf2c159a4cd1722a816bf8f08539ec0ec1e1cabde (patch)
treef6f632c006dc3b18aab51130272c16f32f1b13a5 /scripts/Makefile.thinlto
parent0fb34ebd3330382e61adde030416e9b77fe0f5d2 (diff)
downloadlinux-next-f2c159a4cd1722a816bf8f08539ec0ec1e1cabde.tar.gz
linux-next-f2c159a4cd1722a816bf8f08539ec0ec1e1cabde.zip
assoc_array: replace the labels in gc's tree walk with a loop
assoc_array_gc() walks the old tree depth first, without recursion, building the copy as it goes. Its position is a handful of locals, and its moves are labels: descend copies a node and the shortcut in front of it, continue_node goes on through the node's slots, the code after the fold removes a node holding nothing but a shortcut or a shortcut in front of a small node, and ascend_old_tree climbs back up. Keep the walk and its order, but give the position a structure, struct assoc_array_gc_walk, and each move a function: assoc_array_gc_copy(), assoc_array_gc_next(), assoc_array_gc_pack() and assoc_array_gc_ascend(). assoc_array_gc() becomes a loop that copies a subtree, then finds the next one, packing and climbing past the nodes that are done. Finishing is one test now: after packing, a copy has no parent exactly when it is the whole tree. That covers all four ways the old code finished: the three gotos to gc_complete, and the climb out of a node below a root shortcut that is kept, which now stops at the packing. The copy is made in one place, so gcc inlines all of it into assoc_array_gc(), which has no recursion: its stack frame is 152 bytes, against 128 before, on an x86-64 defconfig. No functional change. Assisted-by: LLM Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Tested-by: David Howells <dhowells@redhat.com> Reviewed-by: David Howells <dhowells@redhat.com>
Diffstat (limited to 'scripts/Makefile.thinlto')
0 files changed, 0 insertions, 0 deletions