[<prev] [next>] [day] [month] [year] [list]
Message-ID: <7beb0d2d.12bea.18842d18f9d.Coremail.sunying@nj.iscas.ac.cn>
Date: Mon, 22 May 2023 17:36:50 +0800 (GMT+08:00)
From: sunying@...iscas.ac.cn
To: peterz@...radead.org, mingo@...hat.com, will@...nel.org
Cc: linux-kernel@...r.kernel.org
Subject: kernel/locking/lockdep.c:2877-2887: dead code
Analyzing the preprocessed statement #ifdef in the kernel/locking/lockdep.c shows that
the functions “check_irq_usage” and “usage_skip” at lines 2877-2887 are defined valid only
under the “CONFIG_PROVE_LOCKING && !(CONFIG_TRACE_IRQFLAGS)” is true.
However, according to the configuration item "CONFIG_PROVE_LOCKING" defined in lib/Kconfig.debug, we can see:
config PROVE_LOCKING
bool "Lock debugging: prove locking correctness"
depends on DEBUG_KERNEL && LOCK_DEBUGGING_SUPPORT
select LOCKDEP
select DEBUG_SPINLOCK
select DEBUG_MUTEXES if !PREEMPT_RT
select DEBUG_RT_MUTEXES if RT_MUTEXES
select DEBUG_RWSEMS
select DEBUG_WW_MUTEX_SLOWPATH
select DEBUG_LOCK_ALLOC
select PREEMPT_COUNT if !ARCH_NO_PREEMPT
select TRACE_IRQFLAGS
default n
If "CONFIG_PROVE_LOCKING: is enabled, "CONFIG_TRACE_IRQFLAGS" is automatically enabled.
The above condition "CONFIG_PROVE_LOCKING && !(CONFIG_TRACE_IRQFLAGS)" will never be true,
so lines 2877-2887 will never be executed.
Should the dead code of line 2877-2887 be deleted?
Best Regards
Yanjie Ren
Ying Sun
Powered by blists - more mailing lists