diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2026-10-11 09:03:09 -0700 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2026-10-13 09:44:50 -0700 |
| commit | d36e0b560483991bc63b7b766f82396e1bf7ec33 (patch) | |
| tree | 0e4904d5a7455f2b4cf5572015d7b565c7419df1 /tools/perf/scripts/python/stackcollapse.py | |
| parent | b2d929a1c2a887dd046e0af2d4a06dbf4e7d87a6 (diff) | |
assoc_array: correct the documentation of get_key_chunk()'s level argument
assoc_array.rst says the level passed to get_key_chunk() will be a
multiple of ASSOC_ARRAY_KEY_CHUNK_SIZE, and asks for the chunk starting
at that bit. assoc_array_walk() after a shortcut, and both insertion
paths, pass the level of a node, which is any multiple of
ASSOC_ARRAY_LEVEL_STEP. Each then shifts the chunk it gets back right
by level & ASSOC_ARRAY_KEY_CHUNK_MASK, so what it wants is the chunk
that contains that bit.
The keyring code copes, because keyring_get_key_chunk() divides the
level by ASSOC_ARRAY_KEY_CHUNK_SIZE before using it. An implementation
written to the documentation does not: one that returns a one-word key
for level 0 and nothing for any other level files leaves under the
wrong slot the first time a node is split, and a later insertion hits
the BUG_ON() after found_slot_for_multiple_occupancy in
assoc_array_insert_into_terminal_node().
Say what the code expects. get_object_key_chunk() is documented as
"the previous function", so this covers it too.
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 'tools/perf/scripts/python/stackcollapse.py')
0 files changed, 0 insertions, 0 deletions
