From nobody Mon Aug 31 23:48:23 2026 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4hYm080P1Vz6qQsh for ; Mon, 31 Aug 2026 23:48:24 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "YR2" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4hYm076qVqz3JlD for ; Mon, 31 Aug 2026 23:48:23 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1788220104; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=ttWK/veMlGbkTHeRWCqE/3Awb+VAyltk9ik7jYzB2gQ=; b=qMLvB/XLynSnQD6kCgJ/w3TUANVQWv0KWnNm7gBJKSYZ6vClkJo+xiiuZ5ZgPdIlaSZosj SSUDFq1xqks2ffxQk5rrD7VVae2UnIBnDgoLGgHPe6tJkxybdNoGx4BiD3wdiuujbNpl3d bO2kNC606JJ2YEA3EEVRgDIBPYR/IowEnr4/QO/8beEvs5UNd6XzMk7kB8/a0Zrv1DyiVx Y1olG0Q/B8/cVQiH3sknKcB7o5gws5JOJBd3cLn1VkFlxpZH9U1yQt8r7ahDnJmAscDdIu u7eM64A9AgIYkG7lZaVGrpyBQ7MZuidqDW+sINjjY/kIjtAfh9fIYQIUIVKaKQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1788220104; a=rsa-sha256; cv=none; b=oa7gDd8mBYMEINERqQM+qX8uoPu0wHolo8WAkBG3ygyVIgDs9KV7/r8PWCLejhJcKSUTmj OzMVUytSgw1kX+ir1ABuLUecPDz23uaXDrCqS/pOsTXtFCEtgOpt1EUU3+0DVRpvmkGRry B3SSr29WHspsipuVYmu8f/m9KC85dGwYUPZ2nNe1GsmexQzYecAMUILu3TIRu1XyinHctj w1Snf0z3eKDwu8GC/MLz6ou8R4DadX1pdWcWsNLzgtSgBLOsUAbVO5hjlID96b2UoSPzei szz9w/jH3H0BmU1t9gGsqOcxmQlNIg51Zy2ksrPOs83CjS5W8Yw+Jmbti0hdDg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1788220104; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=ttWK/veMlGbkTHeRWCqE/3Awb+VAyltk9ik7jYzB2gQ=; b=ShESqXbGrPLNIX3k+Tp0PO6aGCC0h3H0ga7QuTug54n/0u91bqsW6Awqe8ONU93lxj7eTY xt14d47h/RXvInk1y5wQRncUSrgVG0uyp629ldJKTTkIa6VMVF+lFSECuVA1RBwoQvOfwM UO1GL3xankcJR6lWrGvwErKvcejpADlo7YvV5IoaMsFZCxmhDZNioiJpRyDNkzKfjvSdpI MxbATChuHY7wHmzCQ2thSgR79pVoIogKE0D9roGyKLZBCJkTU8XeyDZkzBWczXL+IkW47I 3EtbpLmbU+w4FsvEvmqb1rAsezQRJvqYiEqz+aohFe0HFai9AeyI12xqVssDKg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4hYm075TKlzZ3C for ; Mon, 31 Aug 2026 23:48:23 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 37eb4 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Mon, 31 Aug 2026 23:48:23 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Nick Price Subject: git: ee44a57e34a8 - main - umtx: use a distribution-fair multiplier for the chain hash List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: nprice X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: ee44a57e34a8812b4641d5c9202255ea7883764d Auto-Submitted: auto-generated Date: Mon, 31 Aug 2026 23:48:23 +0000 Message-Id: <6a9612c7.37eb4.b18ce5e@gitrepo.freebsd.org> The branch main has been updated by nprice: URL: https://cgit.FreeBSD.org/src/commit/?id=ee44a57e34a8812b4641d5c9202255ea7883764d commit ee44a57e34a8812b4641d5c9202255ea7883764d Author: Nick Price AuthorDate: 2026-08-31 23:47:12 +0000 Commit: Nick Price CommitDate: 2026-08-31 23:47:24 +0000 umtx: use a distribution-fair multiplier for the chain hash umtxq_hash() multiplies the key by 0x9E370001 and keeps the high bits. That constant is 0x9E37 * 2^16 + 1, so it degenerates for keys whose spacing carries trailing zero bits: at a 64 KiB stride it puts 128 of 512 parked waiters onto a single chain mutex, and at 16 KiB and up it uses only a handful of the 512 chains. Base-system consumers never hit this because libthr places its own wait words 128 bytes apart, but a Linux-ABI runtime waiting on addresses it allocates itself lands squarely on the floor. Switch to 0x61C88647, which leaves at most 3 waiters per chain at the same stride; Linux made this exact change in 2016, after judging the sparse constants "actively bad for hashing". Approved by: adrian (mentor) Reviewed by: kib, adrian, emaste Differential Revision: https://reviews.freebsd.org/D58337 Signed-off-by: Nick Price --- sys/kern/kern_umtx.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/kern/kern_umtx.c b/sys/kern/kern_umtx.c index 69ea90ce9972..ac2469379690 100644 --- a/sys/kern/kern_umtx.c +++ b/sys/kern/kern_umtx.c @@ -113,7 +113,7 @@ (td)->td_user_pri <= PRI_MAX_TIMESHARE) ?\ PRI_MAX_TIMESHARE : (td)->td_user_pri) -#define GOLDEN_RATIO_PRIME 2654404609U +#define GOLDEN_RATIO_32 1640531527U #ifndef UMTX_CHAINS #define UMTX_CHAINS 512 #endif @@ -380,7 +380,7 @@ umtxq_hash(struct umtx_key *key) unsigned n; n = (uintptr_t)key->info.both.a + key->info.both.b; - key->hash = ((n * GOLDEN_RATIO_PRIME) >> UMTX_SHIFTS) % UMTX_CHAINS; + key->hash = ((n * GOLDEN_RATIO_32) >> UMTX_SHIFTS) % UMTX_CHAINS; } struct umtxq_chain *