[tip:locking/core] locking/lockdep: Fix reported required memory size (2/2)

From: tip-bot for Bart Van Assche
Date: Thu Feb 28 2019 - 02:04:33 EST


Commit-ID: 15ea86b58c71d05e0921bebcf707aa30e43e9e25
Gitweb: https://git.kernel.org/tip/15ea86b58c71d05e0921bebcf707aa30e43e9e25
Author: Bart Van Assche <bvanassche@xxxxxxx>
AuthorDate: Thu, 14 Feb 2019 15:00:38 -0800
Committer: Ingo Molnar <mingo@xxxxxxxxxx>
CommitDate: Thu, 28 Feb 2019 07:55:39 +0100

locking/lockdep: Fix reported required memory size (2/2)

Lock chains are only tracked with CONFIG_PROVE_LOCKING=y. Do not report
the memory required for the lock chain array if CONFIG_PROVE_LOCKING=n.
See also commit:

ca58abcb4a6d ("lockdep: sanitise CONFIG_PROVE_LOCKING")

Include the size of the chain_hlocks[] array.

Signed-off-by: Bart Van Assche <bvanassche@xxxxxxx>
Signed-off-by: Peter Zijlstra (Intel) <peterz@xxxxxxxxxxxxx>
Cc: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
Cc: Johannes Berg <johannes@xxxxxxxxxxxxxxxx>
Cc: Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx>
Cc: Paul E. McKenney <paulmck@xxxxxxxxxxxxxxxxxx>
Cc: Peter Zijlstra <peterz@xxxxxxxxxxxxx>
Cc: Thomas Gleixner <tglx@xxxxxxxxxxxxx>
Cc: Waiman Long <longman@xxxxxxxxxx>
Cc: Will Deacon <will.deacon@xxxxxxx>
Cc: johannes.berg@xxxxxxxxx
Cc: tj@xxxxxxxxxx
Link: https://lkml.kernel.org/r/20190214230058.196511-4-bvanassche@xxxxxxx
Signed-off-by: Ingo Molnar <mingo@xxxxxxxxxx>
---
kernel/locking/lockdep.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/kernel/locking/lockdep.c b/kernel/locking/lockdep.c
index 57a523f0273c..ec6f6aff4d8d 100644
--- a/kernel/locking/lockdep.c
+++ b/kernel/locking/lockdep.c
@@ -4270,10 +4270,11 @@ void __init lockdep_init(void)
(sizeof(lock_classes) +
sizeof(classhash_table) +
sizeof(list_entries) +
- sizeof(lock_chains) +
sizeof(chainhash_table)
#ifdef CONFIG_PROVE_LOCKING
+ sizeof(lock_cq)
+ + sizeof(lock_chains)
+ + sizeof(chain_hlocks)
#endif
) / 1024
);