Commit 36bfb9bb authored by Peter Zijlstra's avatar Peter Zijlstra Committed by Ingo Molnar

lockdep: simplify mark_held_locks

remove the explicit state iteration
Signed-off-by: default avatarPeter Zijlstra <a.p.zijlstra@chello.nl>
Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
parent 9fe51abf
...@@ -2253,11 +2253,19 @@ static int mark_lock_irq(struct task_struct *curr, struct held_lock *this, ...@@ -2253,11 +2253,19 @@ static int mark_lock_irq(struct task_struct *curr, struct held_lock *this,
} }
enum mark_type { enum mark_type {
HARDIRQ, #define LOCKDEP_STATE(__STATE) __STATE,
SOFTIRQ, #include "lockdep_states.h"
RECLAIM_FS, #undef LOCKDEP_STATE
}; };
#define MARK_HELD_CASE(__STATE) \
case __STATE: \
if (hlock->read) \
usage_bit = LOCK_ENABLED_##__STATE##_READ; \
else \
usage_bit = LOCK_ENABLED_##__STATE; \
break;
/* /*
* Mark all held locks with a usage bit: * Mark all held locks with a usage bit:
*/ */
...@@ -2272,27 +2280,9 @@ mark_held_locks(struct task_struct *curr, enum mark_type mark) ...@@ -2272,27 +2280,9 @@ mark_held_locks(struct task_struct *curr, enum mark_type mark)
hlock = curr->held_locks + i; hlock = curr->held_locks + i;
switch (mark) { switch (mark) {
case HARDIRQ: #define LOCKDEP_STATE(__STATE) MARK_HELD_CASE(__STATE)
if (hlock->read) #include "lockdep_states.h"
usage_bit = LOCK_ENABLED_HARDIRQ_READ; #undef LOCKDEP_STATE
else
usage_bit = LOCK_ENABLED_HARDIRQ;
break;
case SOFTIRQ:
if (hlock->read)
usage_bit = LOCK_ENABLED_SOFTIRQ_READ;
else
usage_bit = LOCK_ENABLED_SOFTIRQ;
break;
case RECLAIM_FS:
if (hlock->read)
usage_bit = LOCK_ENABLED_RECLAIM_FS_READ;
else
usage_bit = LOCK_ENABLED_RECLAIM_FS;
break;
default: default:
BUG(); BUG();
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment