From nobody Sun Feb 8 09:18:00 2026 Received: from mail-pg1-f201.google.com (mail-pg1-f201.google.com [209.85.215.201]) (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 C013480043 for ; Wed, 7 Aug 2024 14:39:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723041573; cv=none; b=ZQynEJnWg3FPD70TJFfww+1Zqj+4riegusmkAoVwTNLZIGs6VzVhI6gspLmDpkrLvD0ASRoicHl6oykZ31n0W0HWwJndC2fq+WOfTnbmHvD65MaaRvtaikwtIicV/saKKbL3FKMJbmTZ8GQu9o8hQADCr3N6rvpzkompcXZhMFg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723041573; c=relaxed/simple; bh=f3YOeVmxmojhXi3gaufnzSIKLoBAKaoOMdbVywA/UMQ=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=fAeGPhyWB9PohQ+uCSqJKgxlyelO9JnvnlxHoIatEo9MCHHBsi7zSO9GZHFwoL9UUthPuH7cfeiZAnCi6IxJDQNfYIMZSqsryD42NzWl8xVcE0GuDVTuBcvp8YXnwjzv9OS0+7yaFbpzbQ9g62pELjAKO4czqu2mOyrzm7NSoUo= 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=QZ+qrvqs; arc=none smtp.client-ip=209.85.215.201 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="QZ+qrvqs" Received: by mail-pg1-f201.google.com with SMTP id 41be03b00d2f7-6fd42bf4316so2188925a12.2 for ; Wed, 07 Aug 2024 07:39:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1723041571; x=1723646371; 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=NqtXuueqmWOdgyIxvoAq+O/7Hys8ZO2brsimTty10X8=; b=QZ+qrvqsyUcJTH8w5mwGxliNxWyPBAnYRKJzWi0FQ9j4o44len4xmH00bYRrEpI8Vv rYidRvfx5PitHk80+Ug8V4XGLjY5NqrupBteXLCTLzQZeHjOF2+WRwigCZLMjAClhbtD PGMz7twtpKuXDDxNC1tBsytvmzH191v0NURgy5zkmlmOvznO2Ylqi2yi2xb83fe6U8wn r+ntcVgQKtKKg86gDNsZfgmlYiOGwtBFoE2LnQYnT6pB8ZwS/ckpdAB0vzYVtay9SB68 GMH8dTc/KYoQrhtsf/kf/24+LwGRviLPSeMfURhyY7sULCKfVBY4vjNmNhIPMzZRATOW s3sA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723041571; x=1723646371; 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=NqtXuueqmWOdgyIxvoAq+O/7Hys8ZO2brsimTty10X8=; b=Isv0EH4fYl38aa/eAsXhMhNxJwwDE67zypnvrcSTjwtTHYBhO+gebvc9VDe4LvGVq8 okNG4FIKvQKwPCuKur0B3WkIvYvu5J7hCbGCKNYYBinK0sc4foHOjQDieK7hOBUlwf0A dM7AO9DoE/5JKVCSg9Blr2HGAAcDiU1WhANE73+2PamBK/DvsUSS1FIlj3tCdpG+4OrR G9M2YD7NUtr7IO6r1LJlmooTJP5DT2zKSkLiT8BO9oY/QcYDPmnqwzCdyR+M3PR9AWr5 fMbkgoSC4FSF6m0cNcTTeDUxMdN5zG2ZRdwj8O2cZYrxYR/5yM6Qq9Xc0JNMWDOkIfRo 5WCg== X-Gm-Message-State: AOJu0Yy97IRvS70WoCo0I31L+l9LCNTER4pPJ/TntOfkaNg6CgLM6ZQk YTV87NLsXd/0B/tzuYQzj4U5EwYeZuCscHtGJhgnETPIrxGwJR9+guXfOTpStheAvUpAsxhFYiy 8WhG41dVP1Q== X-Google-Smtp-Source: AGHT+IEOXGTlXZUMfM/Oky/YCvQ5K59jM1O4UQk5Vdj19MQR/IOiSWeGD71TeekmhZk7fpbxOZ03zU6g1XO8BQ== X-Received: from xllamas.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:5070]) (user=cmllamas job=sendgmr) by 2002:a63:e314:0:b0:719:3562:2da3 with SMTP id 41be03b00d2f7-7b74883d071mr37201a12.7.1723041570785; Wed, 07 Aug 2024 07:39:30 -0700 (PDT) Date: Wed, 7 Aug 2024 14:39:17 +0000 In-Reply-To: <20240807143922.919604-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: <20240807143922.919604-1-cmllamas@google.com> X-Mailer: git-send-email 2.46.0.rc2.264.g509ed76dc8-goog Message-ID: <20240807143922.919604-2-cmllamas@google.com> Subject: [PATCH v2 1/3] lockdep: fix upper limit for LOCKDEP_*_BITS configs From: Carlos Llamas To: Andrew Morton Cc: linux-kernel@vger.kernel.org, kernel-team@android.com, Carlos Llamas , "J. R. Okajima" , Peter Zijlstra , Boqun Feng , Ingo Molnar , Waiman Long , Will Deacon Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Lockdep has a set of configs used to determine the size of the static arrays that it uses. However, the upper limit that was initially setup for these configs is too high (30 bit shift). This equates to several GiB of static memory for individual symbols. Using such high values leads to linker errors: $ make defconfig $ ./scripts/config -e PROVE_LOCKING --set-val LOCKDEP_BITS 30 $ make olddefconfig all [...] ld: kernel image bigger than KERNEL_IMAGE_SIZE ld: section .bss VMA wraps around address space Adjust the upper limits to the maximum values that avoid these issues. The need for anything more, likely points to a problem elsewhere. Note that LOCKDEP_CHAINS_BITS was intentionally left out as its upper limit had a different symptom and has already been fixed [1]. Reported-by: J. R. Okajima Closes: https://lore.kernel.org/all/30795.1620913191@jrobl/ [1] Cc: Peter Zijlstra Cc: Boqun Feng Cc: Ingo Molnar Cc: Waiman Long Cc: Will Deacon Acked-by: Waiman Long Signed-off-by: Carlos Llamas --- lib/Kconfig.debug | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug index a81d452941ce..baaaedfde0cb 100644 --- a/lib/Kconfig.debug +++ b/lib/Kconfig.debug @@ -1507,7 +1507,7 @@ config LOCKDEP_SMALL config LOCKDEP_BITS int "Bitsize for MAX_LOCKDEP_ENTRIES" depends on LOCKDEP && !LOCKDEP_SMALL - range 10 30 + range 10 24 default 15 help Try increasing this value if you hit "BUG: MAX_LOCKDEP_ENTRIES too low!= " message. @@ -1523,7 +1523,7 @@ config LOCKDEP_CHAINS_BITS config LOCKDEP_STACK_TRACE_BITS int "Bitsize for MAX_STACK_TRACE_ENTRIES" depends on LOCKDEP && !LOCKDEP_SMALL - range 10 30 + range 10 26 default 19 help Try increasing this value if you hit "BUG: MAX_STACK_TRACE_ENTRIES too = low!" message. @@ -1531,7 +1531,7 @@ config LOCKDEP_STACK_TRACE_BITS config LOCKDEP_STACK_TRACE_HASH_BITS int "Bitsize for STACK_TRACE_HASH_SIZE" depends on LOCKDEP && !LOCKDEP_SMALL - range 10 30 + range 10 26 default 14 help Try increasing this value if you need large STACK_TRACE_HASH_SIZE. @@ -1539,7 +1539,7 @@ config LOCKDEP_STACK_TRACE_HASH_BITS config LOCKDEP_CIRCULAR_QUEUE_BITS int "Bitsize for elements in circular_queue struct" depends on LOCKDEP - range 10 30 + range 10 26 default 12 help Try increasing this value if you hit "lockdep bfs error:-1" warning due= to __cq_enqueue() failure. --=20 2.46.0.rc2.264.g509ed76dc8-goog From nobody Sun Feb 8 09:18:00 2026 Received: from mail-pf1-f201.google.com (mail-pf1-f201.google.com [209.85.210.201]) (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 320668248C for ; Wed, 7 Aug 2024 14:39:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723041575; cv=none; b=RVdVH70DTbRExZwahgv4sgKLHcJBkLfwblIIhg5O5hUrqDeWa4nvkdoZZGKFQHnv0MFIqTOgi3Vdu+B3tyXfmqVdwDL8w7QE5dGLdFqU39SX7/saeYot02hsrigHvJijod/ToDUD1v07dkUWQDtMcXdzuh64xbqfICm+Qp5/F6s= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723041575; c=relaxed/simple; bh=WPQeRoVjbHyBaB1jP3uLP9qNWJc7u6TPtPAVY/T4QWc=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=qYyoxWDgp7ne7GU5YSMGYVT6d5icj2+gH2nrfS/JHf8UDulhwhzsgfYUNDP+7LBT5Kidk4V9QKcls8gNbrqR1d5qB3hmrb8Wl6fmU7vbp+QBYYhwAWyIzj4ztpQO41+4B/weY3yIwiJ1hDydEfg+frsOd22ELez3K/0N9IOG3rA= 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=Y+lFol/P; arc=none smtp.client-ip=209.85.210.201 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="Y+lFol/P" Received: by mail-pf1-f201.google.com with SMTP id d2e1a72fcca58-70eb4de4eb9so1911521b3a.2 for ; Wed, 07 Aug 2024 07:39:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1723041573; x=1723646373; 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=xF7GVsamqUptJkU2gJsmYYeaq0bMeaFAbotmm0oMB2I=; b=Y+lFol/P8Q4R1pWvopj1ZoMSp7EKBxyQ4RTxNSKQ2vnDhcEfPcphf+FBuBtLYZobBh RQPxOERnnqJHstai2rswgjLa7o7vEsclPo2tbeFWoMbh/z5n2izJlTF2Z3i/5S6TzFND aShY/M6l/yu8gOud83JDbO8EBnBs+7G/Tq/58XTrRgALe5X5yUEy5cIttQyt7olCEluA NaSVQUOzxdkjTTZa5yUkM06HEp4LRyFtzlL5IQv5W8jAQsQQe93x3XEgkqHNyh7O+EyX d8xI06k16kVQciE2LW7L1t26zgE9TRwewo/bmnWhCf71FaDGAto1FLRsc+IiiB532zW7 2atw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723041573; x=1723646373; 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=xF7GVsamqUptJkU2gJsmYYeaq0bMeaFAbotmm0oMB2I=; b=eU6tLwfQkYLfCQyhIZ4HLuo45ePV6wwqcBuVtfx5PcZpknqphdb7FhB9httIYPf19d mIXpytFRfVpYjXGSXhusbr5tjU6Xbg2mB9oKxGiaJu1dLmRugca7RvO0JGZMmy+2FMOu DVTsUfJ7ZMCeFQN1q+Ic36sEnG24ZPv1vo+Mv0iGgqY8xbWkHAXosVsvJHDg/Y1ZuIv3 9qHXsI6MYrhZpQdnyUI9a4Ge42M/ikS5koNwWpz/4vGL7SEUvG5G+RO1J9XU4hdkV/Fo Cia98H7kMkfOj/B4rZpg9s70wsfjK2ENm2Mn7NO7ytTFKR1jcPpvbBkxbutUVaLLchrP gYxA== X-Gm-Message-State: AOJu0YwSSkEmt8ZuRtdK3KcjRnITT+KRlOMeraDO0TYThghRlZHmguux KAjL8xqnUH2Mx7JtNIw9d1xxWGX+V8rh/EFCiKFaRtlCYByIZjRDi0WQV4LVy0Va/thGPnORs1Z y+gd1Rpc65g== X-Google-Smtp-Source: AGHT+IGZjcSEFFHc8gAyc+MxGkh5ALwM7EKisvXylP1dqOQgjdhJFnjvbXfvVU14q3/0qmnCLiu4AepSqnEP/g== X-Received: from xllamas.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:5070]) (user=cmllamas job=sendgmr) by 2002:a05:6a00:9168:b0:710:4d06:93b3 with SMTP id d2e1a72fcca58-7106d0735d4mr416051b3a.3.1723041573417; Wed, 07 Aug 2024 07:39:33 -0700 (PDT) Date: Wed, 7 Aug 2024 14:39:18 +0000 In-Reply-To: <20240807143922.919604-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: <20240807143922.919604-1-cmllamas@google.com> X-Mailer: git-send-email 2.46.0.rc2.264.g509ed76dc8-goog Message-ID: <20240807143922.919604-3-cmllamas@google.com> Subject: [PATCH v2 2/3] lockdep: clarify size for LOCKDEP_*_BITS configs From: Carlos Llamas To: Andrew Morton Cc: linux-kernel@vger.kernel.org, kernel-team@android.com, Carlos Llamas , Peter Zijlstra , Boqun Feng , Ingo Molnar , Waiman Long , Will Deacon Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" The LOCKDEP_*_BITS configs control the size of internal structures used by lockdep. The size is calculated as a power of two of the configured value (e.g. 16 =3D> 64KB). Update these descriptions to more accurately reflect this, as "Bitsize" can be misleading. Suggested-by: Andrew Morton Cc: Peter Zijlstra Cc: Boqun Feng Cc: Ingo Molnar Cc: Waiman Long Cc: Will Deacon Signed-off-by: Carlos Llamas --- lib/Kconfig.debug | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug index baaaedfde0cb..e0614a415348 100644 --- a/lib/Kconfig.debug +++ b/lib/Kconfig.debug @@ -1505,7 +1505,7 @@ config LOCKDEP_SMALL bool =20 config LOCKDEP_BITS - int "Bitsize for MAX_LOCKDEP_ENTRIES" + int "Size for MAX_LOCKDEP_ENTRIES (as Nth power of 2)" depends on LOCKDEP && !LOCKDEP_SMALL range 10 24 default 15 @@ -1513,7 +1513,7 @@ config LOCKDEP_BITS Try increasing this value if you hit "BUG: MAX_LOCKDEP_ENTRIES too low!= " message. =20 config LOCKDEP_CHAINS_BITS - int "Bitsize for MAX_LOCKDEP_CHAINS" + int "Size for MAX_LOCKDEP_CHAINS (as Nth power of 2)" depends on LOCKDEP && !LOCKDEP_SMALL range 10 21 default 16 @@ -1521,7 +1521,7 @@ config LOCKDEP_CHAINS_BITS Try increasing this value if you hit "BUG: MAX_LOCKDEP_CHAINS too low!"= message. =20 config LOCKDEP_STACK_TRACE_BITS - int "Bitsize for MAX_STACK_TRACE_ENTRIES" + int "Size for MAX_STACK_TRACE_ENTRIES (as Nth power of 2)" depends on LOCKDEP && !LOCKDEP_SMALL range 10 26 default 19 @@ -1529,7 +1529,7 @@ config LOCKDEP_STACK_TRACE_BITS Try increasing this value if you hit "BUG: MAX_STACK_TRACE_ENTRIES too = low!" message. =20 config LOCKDEP_STACK_TRACE_HASH_BITS - int "Bitsize for STACK_TRACE_HASH_SIZE" + int "Size for STACK_TRACE_HASH_SIZE (as Nth power of 2)" depends on LOCKDEP && !LOCKDEP_SMALL range 10 26 default 14 @@ -1537,7 +1537,7 @@ config LOCKDEP_STACK_TRACE_HASH_BITS Try increasing this value if you need large STACK_TRACE_HASH_SIZE. =20 config LOCKDEP_CIRCULAR_QUEUE_BITS - int "Bitsize for elements in circular_queue struct" + int "Size for elements in circular_queue struct (as Nth power of 2)" depends on LOCKDEP range 10 26 default 12 --=20 2.46.0.rc2.264.g509ed76dc8-goog From nobody Sun Feb 8 09:18:00 2026 Received: from mail-pf1-f202.google.com (mail-pf1-f202.google.com [209.85.210.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 88A3C84D04 for ; Wed, 7 Aug 2024 14:39:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.202 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723041577; cv=none; b=CyLncKAO5hmAsbP2tmPeawG6FCDKB0sHdFedq9Yl86GBIZia0AvowzJ8mrGIxSmnHxsMt3cHAK2NUjoK1SFxQ939rVgOKq0YoYPT4j+RNYJyHysbZPW3Zx0Tdbtszkah5irx586AaS8dXAll3/sjalXKkx1RGzsNnASHbfBZaZY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723041577; c=relaxed/simple; bh=AuD1e/htfG1lFR9kSdMvIEtoeOyeABqQKaB/QtDE2F8=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=EAQGQIr/2LzkuQFzsu6fRQrlsokR3yXZWLtCSzKQvlK9/NifkQgYQqH3dSnBZn27CgDrFSE9dA+fRIBkSbS9VaRIr1MVzcXPVjcbdLLeo7aybBKNp55IbqQ/IsLpsZHxosjTRf/q3o3DnytyFBjuMJIPyJVQAHB5F3WGu/9BXzg= 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=xl6duz5M; arc=none smtp.client-ip=209.85.210.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="xl6duz5M" Received: by mail-pf1-f202.google.com with SMTP id d2e1a72fcca58-70eb4de4eb9so1911538b3a.2 for ; Wed, 07 Aug 2024 07:39:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1723041576; x=1723646376; 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=26uLUGt1PbHjw3R3dD99uteqgjJ71bdj6keYRqjuSeo=; b=xl6duz5MIKSbbkUrFT/cd6sTwK25ZYwWq75wbDbcuUH6IQs0qdBKUQQyXhDjH1otd4 UnvShibEA3kicEQLFSKwQVRZYefcfp+OdRvK+JvDpbp7lJUiDRmw39r8eHSzIRcwVSJt 4XBsPlQXKC4Jod5l9adDefdkxuJdZCVAFKoamRDObiBNwmEsWKjTX7IBNUePDUkoOaLI z7iRNU7VsJv4cSxOoM6s/eBxra4RvyqoYEI9wWzdFX0Hx++EZ7SoPs97DfY6k/LadAXy Z2U4GR8WujkH+7ZEu0ZDmFx+SLI27pcPtTI8feDpIjezk09ngHg3h4KC1JGehPIw+f54 3m4w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723041576; x=1723646376; 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=26uLUGt1PbHjw3R3dD99uteqgjJ71bdj6keYRqjuSeo=; b=HBmPFRFPLzanjkfgFgo9kBRVY4qaCBFzHBKOUWtnW+i+ewYKlXPIZJp77bCmNKvffn hnfrKjUE37Fz/rIlp1lWCkSHhhiqx6VKhty/k1rAwP+mkgkvDdVQbbKCuLpQBdo6lb2p a8TNmUVoezJ7tfxFhI4p9SttpJLje0/jQAH+wU6bqHWXeDASVKUDn0DUF/NAlzM+oUjA scfExbKgktICPAk6Xq1EDUDV37+fwCdFJ1EXG1HBXVYtF5/Q+op3EfOrz3h1lHSd+B/1 3UukcE0b9HpKBZ7ppokaUstc906B7gr61Q7MFufk7DYJCzHK6FpyZ/vUFzSlZAWbO+WY t0ZQ== X-Gm-Message-State: AOJu0Yw7uUGzhoLCZI4WTSyzj/ltkmwXhCpjNz88NznukXE45xzalDDz N+L5NsKy6JGSwfQ+SnG15uAatZ2gA7DWjhNKjoZkhmDCaWHG7PEiKOV9QsM7GAIa2+QcPWVIBNQ gGQZjm85y2A== X-Google-Smtp-Source: AGHT+IEZMcCt1x+PG1vtH8TF7MugLb9TpmzKqwXDpbLZ8DPfCHSERoPeDJ86A+OyXAQiHcK24I8oxCxpxP4D/A== X-Received: from xllamas.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:5070]) (user=cmllamas job=sendgmr) by 2002:a05:6a00:6f0b:b0:710:4d1c:9ee0 with SMTP id d2e1a72fcca58-7106d0861efmr343810b3a.4.1723041575752; Wed, 07 Aug 2024 07:39:35 -0700 (PDT) Date: Wed, 7 Aug 2024 14:39:19 +0000 In-Reply-To: <20240807143922.919604-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: <20240807143922.919604-1-cmllamas@google.com> X-Mailer: git-send-email 2.46.0.rc2.264.g509ed76dc8-goog Message-ID: <20240807143922.919604-4-cmllamas@google.com> Subject: [PATCH v2 3/3] lockdep: document MAX_LOCKDEP_CHAIN_HLOCKS calculation From: Carlos Llamas To: Peter Zijlstra , Ingo Molnar , Will Deacon Cc: linux-kernel@vger.kernel.org, kernel-team@android.com, Andrew Morton , Carlos Llamas , Waiman Long , Huang Ying , "J. R. Okajima" , Boqun Feng 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 Signed-off-by: Carlos Llamas Acked-by: Waiman Long --- 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.46.0.rc2.264.g509ed76dc8-goog