Article View: linux.kernel.netdev
Article #7512Re: [RFC PATCH] lockdep: Keep dynamic key hash nodes in lockdep-owned storage
From: Boqun Feng
Date: Mon, 26 Oct 2026 14:07
Date: Mon, 26 Oct 2026 14:07
53 lines
12211 bytes
12211 bytes
On Fri, Oct 23, 2026 at 05:19:46AM -0700, Vlad Poenaru wrote: > On 10/21/26 8:01 PM, Bart Van Assche wrote: > > This patch introduces a new hard upper limit on the number of dynamic > > lockdep keys. That's unfortunate but I assume it's not possible to > > eliminate this hard upper bound if the key storage is owned by > > lockdep? > > It isn't inherent; it comes from preallocating the nodes the way lockdep > does for its other tables. Two ways to lift it: > > 1. Fall back to the embedded node when the pool is full. Keys > registered after that are linked through their own hash_entry, as > today, and only those wait for a grace period when they are > unregistered. The key stays at 16 bytes and there is a second lookup > path, but running out becomes a slowdown instead of lockdep turning > itself off. > This gives me feeling that we did something for nothing, because in a system where there are a plenty of dynamic keys, we back to the current status after we introduce another hashlist. > 2. Grow the pool in chunks allocated outside the graph lock in > lockdep_register_key(). That removes the bound without a fallback, > but it is the allocation Boqun preferred to avoid. > > For what it's worth, keys whose locks are ever taken already count > against MAX_LOCKDEP_KEYS (8K classes), and the default pool is 16K, so > what the cap adds is a limit on keys that never get a class. > Yeah, I think if everyone call lockdep_init_map_type() right after lockdep_register_key(), MAX_LOCKDEP_KEYS will be reached to the limit before MAX_LOCKDEP_DYNAMIC_KEYS. So technically it's not a new limitation. Honestly you can just make MAX_LOCKDEP_DYNAMIC_KEYS = 2 * MAX_LOCKDEP_KEYS (i.e. without introducing a Kconfig), "2 *" is needed because a key can be in-between lockdep_register_key() and lockdep_init_map_type() and pending_free can be delayed, so "2 *" provides a buffer for when active key numbers > class numbers. It might be worth checking whether a lockdep_register_key() is always followed by a some sort of lockdep_init_map_type() in the kernel code base. Regards, Boqun > Boqun, would you prefer (1), so that the cap can never turn lockdep off? > > Thanks, > Vlad
Technical Details
Message-ID:
<at9eq_3YUIL1ACEK@tardis.local>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-351933-linux-kernel-netdev=dewy.ruReferences:
<ef57e0ab-f0b4-46d6-a2f8-f6c97fec8d8e@acm.org> <20261023121946.2260882-1-vlad.wing@gmail.com>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-351933-linux-kernel-netdev=dewy.ru
From: boqun@kernel.org (Boqun Feng)
Newsgroups: linux.kernel.netdev
Subject: Re: [RFC PATCH] lockdep: Keep dynamic key hash nodes in
lockdep-owned storage
Date: Mon, 26 Oct 2026 07:07:39 -0700
Organization: Usenet Network
Message-ID: <at9eq_3YUIL1ACEK@tardis.local>
References: <ef57e0ab-f0b4-46d6-a2f8-f6c97fec8d8e@acm.org>
<20261023121946.2260882-1-vlad.wing@gmail.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Injection-Info: usenet.network;
logging-data="1323531"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:7ZbrV8BI92Or+GpZ8ibOJWg3pYQ= sha256:3HW/7tktZyaYDzu/tSD52Q5aRCC+xepQmyM/SZGrBOw=
sha1:d2dzLGFuKemvk6FkHfINS1X88yk= sha256:0zH3jYzHOvZBdcGs631o5oem/5mAzAsY7/tY7r1CC+w=
Content-Disposition: inline
List-ID: <netdev.vger.kernel.org>
X-Mailpost-Empty-Hdrs: X-Spam-Level
X-Received: from localhost (localhost [127.0.0.1])
by mail.dewy.ru (Postfix) with ESMTP id 5235C125BAB; Mon, 26 Oct 2026 17:11:22 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.739
X-Spam-Status: No, score=-3.739 tagged_above=-9999 required=6.31
tests=[DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.339, DKIM_SIGNED=0.1,
DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1,
MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001,
SPF_PASS=-0.001] autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key)
header.d=kernel.org
X-Received: from mail.dewy.ru ([127.0.0.1])
by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024)
with ESMTP id RcNIuyTghJY5;
Mon, 26 Oct 2026 17:11:19 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=104.64.211.4; helo=sin.lore.kernel.org; envelope-from=netdev+bounces-351933-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN>
X-Authentication-Results: OpenDMARC; dmarc=pass (p=quarantine dis=none) header.from=kernel.org
X-Received: from sin.lore.kernel.org (sin.lore.kernel.org [104.64.211.4])
by mail.dewy.ru (Postfix) with ESMTPS id 01F90125BA9; Mon, 26 Oct 2026 17:11:07 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
by sin.lore.kernel.org (Postfix) with ESMTP id A545F2244D; Mon, 26 Oct 2026 14:07:47 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass;
t=1793023664;
b=qW/u1jP74j3wqBxnMxNSJq4dujseuFg65CftXSIpqnRlSRxxZWocYBMGug4tN6cGd3xM
6d5+U3XeqsOOyt6LiPD9zchBLP8pNzTutis8oTb5F6nnSmUnxEdsT6vPqLK1YbzUblrWH
IF3dwv6JQ2oOZFeppp75o4jASNabENC4Mka8ABIZFPnMzLwr9uPvVM4qYVK+okx3nH9Ox
5cQHFUCt5T1HnHU2EchhgR+Ij4f9Iu6l1DWNBUlqarWNIRmHwPzSzeLVyA15P67YcULAQ
zukDI8Za3ydGFhBOHvcu0F/pBPuzLbYDNHcjOtSqUTouFAo3y2Gz48zHHxYJurCGDPA==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
a=rsa-sha256; c=relaxed/relaxed; t=1793023664;
h=X-Original-To:Received:Received:DKIM-Signature:Received:Received:
X-ME-Sender:X-ME-Received:X-ME-Proxy-Cause:X-ME-Proxy:Feedback-ID:
Received:Date:From:To:Cc:Subject:Message-ID:References:X-Mailing-List:
List-Id:List-Post:List-Help:List-Subscribe:List-Unsubscribe:
List-Owner:Precedence:MIME-Version:Content-Type:Content-Disposition:
In-Reply-To;
bh=XakBI9gtX78sZAtOezqM1zuZ81mvr8zjp5zgGUEv5HU=;
b=x+VBKFTjApYytLkN5hXdnl9MX4AQY4+bt6hCCclte47IOhRseiF4gBV3VBHqJhEBQLXw
EJ+kvVACz2Bo18fG3GETQsQoHxs87xDzi7jvov4um0tK+kUSqOpRdfZOEQJwXHMM2MhAI
UUCxLKbjtk6qIaCdg9Owr58bqTqE78xXBRpEz524Cwid8nn9ct6Lipxdsp1PaRwGYvxKH
pe0ztU/0oat61d0h4GamcAml8x+QV2JxN+JriuCAKffxAuRlEqt6LbC02NiIr3LevVAsO
XClaiA7+7Kvgte5fp+sOfU1hVOxc5iIpXONrivzhh7nCp0DYZvwdFzjFggKffQX5tlg==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org;
dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=WxCaJxpS;
arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-Received: from localhost.localdomain (localhost [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id 04B22606A329;
Mon, 26 Oct 2026 14:07:44 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key, unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=WxCaJxpS
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
t=1793023663;
b=M+cjLf5Dsu5KdfGADKq3S/rm92LHtqmr/fupMPjZptkByAObCrNVabwIXbuoUjtYWgkj
6kkcEWndgp7e+Ya4++O6GrKoZneyzTR2axvt5YDVQz709i75BxJEtVXow5RRjc1B997fS
FeeKKusiaOhdEhcCxesCOikAz1M5+Ee1nESujiGVnGwtEEh1akqLL6G7WgegVhOC68RmQ
veK1EpkSowNER+D70mjRAp4H+J0Rq18WY9PtidU3S+BwDuoC514C17hzFH/q96bVaCp01
8XRlhatPsH5ZV2Gkli8SNFAxervCTZ9fvQ2Ry6BWZXAECsIaoJ4MNF2JA8+8cIpXw0A==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
a=rsa-sha256; c=relaxed/relaxed; t=1793023663;
h=Received:DKIM-Signature:Received:Received:X-ME-Sender:X-ME-Received:
X-ME-Proxy-Cause:X-ME-Proxy:Feedback-ID:Received:Date:From:To:Cc:
Subject:Message-ID:References:MIME-Version:Content-Type:
Content-Disposition:In-Reply-To;
bh=XakBI9gtX78sZAtOezqM1zuZ81mvr8zjp5zgGUEv5HU=;
b=1pjm87dwOZeOWhllJXQzE9vh2G3QttK4UW5QHrSmKVAxg/x7dnQcF4qfn4wgwIE4yvOQ
FChoGzn4I7ZootSB1KT0kMcqfBeVC59LFsglAE1EmvDddypGwqkL6v3w5pN9SopLB0NYX
xugY0BiJniueR/bWVs/8j7ROkDJxPLOwTQDT2hpVmyMb56haCXyPiecjAJWHNfkDQms36
c3gwWDrBzOGmx4wVOqD+Cy7CfxTtW0nH/Rb2NCoYxkerRrlWkheVDy0gtYFoSPjJeOToP
0fJhXdysiv49VpECyye/TkOz8TpMMZyW8sle/+XlMGCc8BRwJSi2MWGu+xt5sTi5N2g==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org;
dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=WxCaJxpS;
arc=none smtp.remote-ip=100.103.45.18
X-Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18])
(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
key-exchange X25519 server-signature ECDSA (prime256v1))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id DE625606A31B
for <netdev@vger.kernel.org>; Mon, 26 Oct 2026 14:07:42 +0000 (UTC)
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4655D1F01829;
Mon, 26 Oct 2026 14:07:42 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org;
s=k20260515; t=1793023662;
bh=XakBI9gtX78sZAtOezqM1zuZ81mvr8zjp5zgGUEv5HU=;
h=Date:From:To:Cc:Subject:References:In-Reply-To;
b=WxCaJxpS4RT5Rt6eFzT7+wZgOe/GRPAmjH3AqsGfiakObwHg1VY1JJNi0pIrPnik7
LWYUmo8hc6UufQZ6WHKxTq9xYwbctTZ+0V8AZm/Z02qLsvfpJt7QpBAZgJOCKzRq8b
sO7fSzYxI/xVJdBACOmvAHKmydVSAMW8sUJZZm+pSIFUmUMVDQnzgfjRaYB7HOKPfB
8K/X3fm9h1Ezl7Pbgv0hIS5Bah6UFMYHfpQFCQK7NfXthDC1gzOTcq7h57iFe/sWML
xIx3xXObFoyp8zxwmf0IcVx7xyYYpYRotsMlMTcylm+ek7EU4LeQjkZ4lLZHCkyk9l
9Az6ytO70tYAw==
X-Received: from phl-compute-04.internal (phl-compute-04.internal [10.202.2.44])
by mailfauth.phl.internal (Postfix) with ESMTP id 4787AF4006B;
Mon, 26 Oct 2026 10:07:41 -0400 (EDT)
X-Received: from phl-frontend-03 ([10.202.2.162])
by phl-compute-04.internal (MEProx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5qBwawyb2C790iv0A5eWl3zj9sw>
<xmx:rV7fal2ITUuwZfrcHWTVWXb6FsV6O_9_XTUUpORo0oB2y_6W9Aag1A>
<xmx:rV7favyQCLK6X5mq_0aCQY5GHIagP8RdKxmzxQLtm-UwUAQkSpfn1Q>
<xmx:rV7fauhwr3eY2MdtPVEq4FUUJfYmy68tIIWhUT3azTJhfSbtPkd6nQ>
<xmx:rV7fakPKgwsOlzoHYmI3hM607W9wsrCo-oIKB5fXC-woliI2ku0BskAO>
X-Feedback-ID: i8dbe485b:Fastmail
X-Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon,
26 Oct 2026 10:07:40 -0400 (EDT)
X-Cc: Bart Van Assche <bvanassche@acm.org>,
Peter Zijlstra <peterz@infradead.org>,
Ingo Molnar <mingo@redhat.com>, Will Deacon <will@kernel.org>,
Waiman Long <longman@redhat.com>,
Andrew Morton <akpm@linux-foundation.org>,
Eric Dumazet <edumazet@kernel.org>,
Davide Caratti <dcaratti@redhat.com>,
Breno Leitao <leitao@debian.org>, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org
X-Mailing-List: netdev@vger.kernel.org
X-List-Post: <mailto:netdev@vger.kernel.org>
X-List-Help: <mailto:netdev+help@vger.kernel.org>
X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org>
X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org>
X-List-Owner: <mailto:netdev+owner@vger.kernel.org>
X-Precedence: list
X-In-Reply-To: <20261023121946.2260882-1-vlad.wing@gmail.com>