From nobody Mon Nov 25 21:22:39 2024 Received: from mail-yw1-f202.google.com (mail-yw1-f202.google.com [209.85.128.202]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 574D41FC7D9 for ; Thu, 24 Oct 2024 18:36:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.202 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729795005; cv=none; b=uTxAzZz3i4M6WGUN7Nh49cCx4F+nTXj5xuhq0CpAiHavLHc7j3chsDL3U38tIxx7yEm2gQ8BtXpK8SV/FWJu3jRdMw/6ByvSNlndOHVxhaHVtbthIs1GRkls22RS4Zh7uKmmmMxFGlyxV6EEVhFPRkFc2FClsg1LIAQeUlPjnsQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729795005; c=relaxed/simple; bh=3kiHpo0x4JoZC6Rs7bU0fkNLNXIKhCfPNpg1vpNlwkc=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=Td4jOgJ8prKGUGVYBWZUX3tCfQ9mPnOsSh0K5doeFjjpHbMk4wE0gqj1OT2FOLj08RVPCiGfMSQfOpj8YA+RL3KLt3ktQCQeYpLsLZZwx6OKHHJRCDRXCJ56UNcUbl/Ftjbp6DKgGeI+u7RrD5B6Ad0GuSlGNL9IeW2/byW/x9I= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--cmllamas.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=21OcgwGX; arc=none smtp.client-ip=209.85.128.202 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--cmllamas.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="21OcgwGX" Received: by mail-yw1-f202.google.com with SMTP id 00721157ae682-6e35d1d8c82so22017167b3.3 for ; Thu, 24 Oct 2024 11:36:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1729795002; x=1730399802; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=Av5TcrKQ0emSnE/TneH2xzU4DKf3Pe9BcgJTocLWv6k=; b=21OcgwGXozWmG9BEw6we1s0wrdwVYmi69Mvg/eXGvVFibHJTaot3tnidhFQB0DXroH tQhnQi/DEmrmQb3YoTRxMtRMQwvvx8AtG0oa0HnAQMMArqGZr4HsGXRx8Nr5+TzpwKw5 NPsHYz/OORCasYaKAX5Pwzo2AJXZ2lETE+qxzHqfCD650lXOaOlJavEmDbIUOTN1gGJa Rh1BcLwoaiBk7PY0Zxg6G6yh3cCS3bB4Xkv/j4RctS560jwFtVVs6nThcoRtzQ43eHgr cbKpz4pDVEvI6Zi7slfpMH7QoqbpBcg59FAXalWjbLlcY3WDt55kpnEDErXeAxDqCcix EoUQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729795002; x=1730399802; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=Av5TcrKQ0emSnE/TneH2xzU4DKf3Pe9BcgJTocLWv6k=; b=HrcVtYi0RpGT21n3Ykn36lKksutwDwU5/lf+7fIKYmahdGs2mZ6OE3Aw2bGaVm/KBN 7NVAzY2dop8QrrVwKZNS0Bpxs7VaM5arXKzSGCqTqNY+K4anfXQvTddjH8sSK41kXERZ dhDFNGp8tR6563p0k0yuJ0Yh6x0FDg0EZSuv4pnBuH1CEjzHFQnbrl2HkSzFDDsOkBb2 KNfGY+YsRad+XODTGoJT9YkaWX/A6zwtKh9v4+iPERXc5yTDojedu79cd2B+XBsU7BZ7 N6TD47dcxMTuZPYuilc6QSJsMuGT0h2DSzIpp9vs/6fnTstn56H7abYcwyFaMl7f0ZK/ Pn8A== X-Gm-Message-State: AOJu0YyMiWlz8+pz1Tna9H0bSjWjtd3U1haZa9RzPhR8lcnJC6aExp9K bDXcrFYPzNGFBd4Awmg8KGbK1P06NCrT42sJAmY8r4pVkYxOeXXKY88OGpEsGf2tliTdL/S/F3s YItftjH6yGQ== X-Google-Smtp-Source: AGHT+IEaHfj7A1f4KlpGTBNrwNkb5CcfS6KTqWpzwjm4zW82/1tDEVQPsR6Fed1wLSSEGkjI2tU6GGymXjdVhA== X-Received: from xllamas.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:5070]) (user=cmllamas job=sendgmr) by 2002:a05:690c:7449:b0:6e2:12e5:356f with SMTP id 00721157ae682-6e86637045dmr1541677b3.3.1729795002388; Thu, 24 Oct 2024 11:36:42 -0700 (PDT) Date: Thu, 24 Oct 2024 18:36:28 +0000 In-Reply-To: <20241024183631.643450-1-cmllamas@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20241024183631.643450-1-cmllamas@google.com> X-Mailer: git-send-email 2.47.0.163.g1226f6d8fa-goog Message-ID: <20241024183631.643450-4-cmllamas@google.com> Subject: [PATCH v3 3/3] lockdep: document MAX_LOCKDEP_CHAIN_HLOCKS calculation From: Carlos Llamas To: Boqun Feng , Andrew Morton , Peter Zijlstra , Ingo Molnar , Will Deacon Cc: linux-kernel@vger.kernel.org, kernel-team@android.com, Carlos Llamas , Waiman Long , Huang Ying , "J. R. Okajima" Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Define a macro AVG_LOCKDEP_CHAIN_DEPTH to document the magic number '5' used in the calculation of MAX_LOCKDEP_CHAIN_HLOCKS. The number represents the estimated average depth (number of locks held) of a lock chain. The calculation of MAX_LOCKDEP_CHAIN_HLOCKS was first added in commit 443cd507ce7f ("lockdep: add lock_class information to lock_chain and output it"). Suggested-by: Waiman Long Cc: Huang Ying Cc: J. R. Okajima Cc: Peter Zijlstra Cc: Boqun Feng Cc: Ingo Molnar Cc: Will Deacon Acked-by: Waiman Long Signed-off-by: Carlos Llamas Acked-by: "Huang, Ying" --- v3: collect tags v2: switched the comment for a macro as suggested by Waiman Long. kernel/locking/lockdep_internals.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/kernel/locking/lockdep_internals.h b/kernel/locking/lockdep_in= ternals.h index bbe9000260d0..20f9ef58d3d0 100644 --- a/kernel/locking/lockdep_internals.h +++ b/kernel/locking/lockdep_internals.h @@ -119,7 +119,8 @@ static const unsigned long LOCKF_USED_IN_IRQ_READ =3D =20 #define MAX_LOCKDEP_CHAINS (1UL << MAX_LOCKDEP_CHAINS_BITS) =20 -#define MAX_LOCKDEP_CHAIN_HLOCKS (MAX_LOCKDEP_CHAINS*5) +#define AVG_LOCKDEP_CHAIN_DEPTH 5 +#define MAX_LOCKDEP_CHAIN_HLOCKS (MAX_LOCKDEP_CHAINS * AVG_LOCKDEP_CHAIN_D= EPTH) =20 extern struct lock_chain lock_chains[]; =20 --=20 2.47.0.163.g1226f6d8fa-goog