From: Julian Braha <julianbraha@gmail.com>
To: nathan@kernel.org, nsc@kernel.org
Cc: samitolvanen@google.com, torvalds@linux-foundation.org,
ljs@kernel.org, david.laight.linux@gmail.com, sashal@kernel.org,
lzsx618@gmail.com, zuoan.penguin@gmail.com, petr.pavlu@suse.com,
jani.nikula@intel.com, xur@google.com, sidnayyar@google.com,
robertusdchris@gmail.com, acourbot@nvidia.com,
linux-modules@vger.kernel.org, linux-kbuild@vger.kernel.org,
linux-kernel@vger.kernel.org,
Julian Braha <julianbraha@gmail.com>
Subject: [PATCH 0/5] kconfig: fix slow 'make oldconfig' by reverting host header simplifications
Date: Fri, 27 Nov 2026 00:00:10 +0000 [thread overview]
Message-ID: <20261127000015.3662267-1-julianbraha@gmail.com> (raw)
As Linus noted when reporting the 'make oldconfig' performance issue [1],
when the kernel's internal hash table implementation was copied over for
Kconfig to use, it also improperly simplified these headers.
By passing '(key) % HASH_SIZE(table)' to hash_head(), this caused a poor
hash table distribution due to using the clear lower bits with power-2
hash table size, leading to a slowdown in Kconfig's expr_lookup() which
makes heavy use of this.
To resolve the performance issue, let's revert the simplifications such
that the signatures of the host functions match the original and takes
the number of bits. Also, replace XOR in Kconfig's expr_lookup() as
suggested by Linus.
Patches 1-3 are pure refactors, restoring code from the original
hash.h and hashtable.h; 4 and 5 resolve the performance issue directly:
Patch 1/5 reverts the removal of the bit count parameter from hash_32()
and hash_ptr() in scripts/include/hash.h (needed by hashtable.h in 3/5).
Patch 2/5 reverts the removal of the 64-bit path from hash_ptr(), so that
potential future callers can safely pass higher bit counts.
Patch 3/5 restores the original names of DEFINE_HASHTABLE() and
DECLARE_HASHTABLE() from the in-kernel implementation.
Patch 4/5 reverts the removal of the bit count parameter from
DECLARE_HASHTABLE and DEFINE_HASHTABLE in scripts/include/hashtable.h.
Patch 5/5 replaces XOR with addition in expr_lookup().
Link: https://lore.kernel.org/all/CAHk-=wi_GuySe0L-uCAM2+nScCLYGBp5BLi6UUPR1gALmNM_3w@mail.gmail.com/ [1]
---
Julian Braha (5):
scripts: add bit count parameter back to host hash functions
scripts: restore full 64-bit support in the host hash functions
scripts: restore host hash table macro names
scripts: add bit count parameter back to the host hash table functions
kconfig: replace XOR with addition for expr_lookup() key generation
scripts/gendwarfksyms/cache.c | 4 ++--
scripts/gendwarfksyms/die.c | 4 ++--
scripts/gendwarfksyms/gendwarfksyms.h | 4 ++--
scripts/gendwarfksyms/kabi.c | 4 ++--
scripts/gendwarfksyms/symbols.c | 6 +++---
scripts/gendwarfksyms/types.c | 2 +-
scripts/genksyms/genksyms.c | 4 ++--
scripts/include/hash.h | 20 ++++++++++++++++----
scripts/include/hashtable.h | 24 ++++++++++++++++++------
scripts/kconfig/expr.c | 4 ++--
scripts/kconfig/internal.h | 8 ++++----
scripts/kconfig/symbol.c | 2 +-
scripts/kconfig/util.c | 2 +-
scripts/mod/modpost.c | 2 +-
14 files changed, 57 insertions(+), 33 deletions(-)
--
2.56.0
next reply other threads:[~2026-11-27 0:00 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-27 0:00 Julian Braha [this message]
2026-11-27 0:00 ` [PATCH 1/5] scripts: add bit count parameter back to host hash functions Julian Braha
2026-11-27 1:16 ` Linus Torvalds
2026-11-27 1:34 ` Linus Torvalds
2026-11-27 0:00 ` [PATCH 2/5] scripts: restore support for 64-bit pointers in " Julian Braha
2026-11-27 0:00 ` [PATCH 3/5] scripts: restore host hash table macro names Julian Braha
2026-11-27 0:00 ` [PATCH 4/5] scripts: add bit count parameter back to the host hash table functions Julian Braha
2026-11-27 0:00 ` [PATCH 5/5] kconfig: replace XOR with addition for expr_lookup() key generation Julian Braha
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261127000015.3662267-1-julianbraha@gmail.com \
--to=julianbraha@gmail.com \
--cc=acourbot@nvidia.com \
--cc=david.laight.linux@gmail.com \
--cc=jani.nikula@intel.com \
--cc=linux-kbuild@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-modules@vger.kernel.org \
--cc=ljs@kernel.org \
--cc=lzsx618@gmail.com \
--cc=nathan@kernel.org \
--cc=nsc@kernel.org \
--cc=petr.pavlu@suse.com \
--cc=robertusdchris@gmail.com \
--cc=samitolvanen@google.com \
--cc=sashal@kernel.org \
--cc=sidnayyar@google.com \
--cc=torvalds@linux-foundation.org \
--cc=xur@google.com \
--cc=zuoan.penguin@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox