Linux Modules
 help / color / mirror / Atom feed
* [PATCH 0/5] kconfig: fix slow 'make oldconfig' by reverting host header simplifications
@ 2026-11-27  0:00 Julian Braha
  2026-11-27  0:00 ` [PATCH 1/5] scripts: add bit count parameter back to host hash functions Julian Braha
                   ` (4 more replies)
  0 siblings, 5 replies; 8+ messages in thread
From: Julian Braha @ 2026-11-27  0:00 UTC (permalink / raw)
  To: nathan, nsc
  Cc: samitolvanen, torvalds, ljs, david.laight.linux, sashal, lzsx618,
	zuoan.penguin, petr.pavlu, jani.nikula, xur, sidnayyar,
	robertusdchris, acourbot, linux-modules, linux-kbuild,
	linux-kernel, Julian Braha

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


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2026-11-27  1:34 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-27  0:00 [PATCH 0/5] kconfig: fix slow 'make oldconfig' by reverting host header simplifications Julian Braha
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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox