Skip to content

Conversation

@dvyukov
Copy link
Collaborator

@dvyukov dvyukov commented Jan 22, 2026

  • tools/clang/codesearch: index struct references
  • tools/syz-codesearch: add cpu/mem profiling
  • pkg/codesearch: reduce memory consumption when building index
  • pkg/codesearch: reduce memory consumption more
  • pkg/codesearch: reduce memory consumption a bit more

With all references in the index, it become quite big.
Merge and dedup the resulting index on the fly.
Also intern all strings b/c there are tons of duplicates.

This also removes unnecessary duplicates (effectively ODR violations in the kernel)
due to use of BUILD_BUG_ON. The macro produces different function calls
in different translations units, so the same function may contain
__compiletime_assert_N1 call in one TU and __compiletime_assert_N2 in another.

Over this reduces resource consumption of index building from:
time:296.11s user:16993.71s sys:6661.03s memory:82707MB
to:
time:194.28s user:16860.01s sys:6647.01s memory: 3243MB

25x reduction in memory consumption.
Use uint8 enums instead of strings to store entity/reference kind.
String is 16 bytes and is slower to work with.
Use uint32 instead of int for line numbers (2G lines should be enough for everyone).
Reorder fields to remove unnecessary paddings.
@dvyukov dvyukov requested a review from a-nogikh January 22, 2026 11:13
@dvyukov dvyukov enabled auto-merge January 22, 2026 11:13
@dvyukov dvyukov mentioned this pull request Jan 22, 2026
@dvyukov dvyukov added this pull request to the merge queue Jan 22, 2026
Merged via the queue into google:master with commit 623df38 Jan 22, 2026
18 checks passed
@dvyukov dvyukov added the AI patching Feature requests and bugs related to AI-based kernel bug fix generation. label Jan 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

AI patching Feature requests and bugs related to AI-based kernel bug fix generation.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants