]> git.baikalelectronics.ru Git - kernel.git/commit
locking/rwsem: Add DEBUG_RWSEMS to look for lock/unlock mismatches
authorWaiman Long <longman@redhat.com>
Fri, 30 Mar 2018 21:27:58 +0000 (17:27 -0400)
committerIngo Molnar <mingo@kernel.org>
Sat, 31 Mar 2018 05:30:50 +0000 (07:30 +0200)
commitb3251c86c23591df246d07ee54bad3ebf9986d39
treedc8965899aaab98faf1c1f0b7319fd1af2dde616
parent5b42c281b831bcdb885a95eeb91ea02e40dc7d9c
locking/rwsem: Add DEBUG_RWSEMS to look for lock/unlock mismatches

For a rwsem, locking can either be exclusive or shared. The corresponding
exclusive or shared unlock must be used. Otherwise, the protected data
structures may get corrupted or the lock may be in an inconsistent state.

In order to detect such anomaly, a new configuration option DEBUG_RWSEMS
is added which can be enabled to look for such mismatches and print
warnings that that happens.

Signed-off-by: Waiman Long <longman@redhat.com>
Acked-by: Davidlohr Bueso <dave@stgolabs.net>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Link: http://lkml.kernel.org/r/1522445280-7767-2-git-send-email-longman@redhat.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
kernel/locking/rwsem.c
kernel/locking/rwsem.h
lib/Kconfig.debug