locking/lockdep: Consolidate lock usage bit initialization

Lock usage bit initialization is consolidated into one function
mark_usage(). Trivial readability improvement. No functional change.

Signed-off-by: Yuyang Du <[email protected]>
Signed-off-by: Peter Zijlstra (Intel) <[email protected]>
Cc: Linus Torvalds <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Cc: Thomas Gleixner <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Link: https://lkml.kernel.org/r/[email protected]
Signed-off-by: Ingo Molnar <[email protected]>
This commit is contained in:
Yuyang Du authored and Ingo Molnar committed 2019-06-03 11:55:51 +02:00
1 parent 68e9dc29f8
commit 0918065151
1 file changed
+14 -8
+14 -8
View File
@@ -3460,8 +3460,12 @@ void trace_softirqs_off(unsigned long ip)
debug_atomic_inc(redundant_softirqs_off);
}
static int mark_irqflags(struct task_struct *curr, struct held_lock *hlock)
static int
mark_usage(struct task_struct *curr, struct held_lock *hlock, int check)
{
if (!check)
goto lock_used;
/*
* If non-trylock use in a hardirq or softirq context, then
* mark the lock as used in these contexts:
@@ -3505,6 +3509,11 @@ static int mark_irqflags(struct task_struct *curr, struct held_lock *hlock)
}
}
lock_used:
/* mark it as used: */
if (!mark_lock(curr, hlock, LOCK_USED))
return 0;
return 1;
}
@@ -3546,8 +3555,8 @@ int mark_lock_irq(struct task_struct *curr, struct held_lock *this,
return 1;
}
static inline int mark_irqflags(struct task_struct *curr,
struct held_lock *hlock)
static inline int
mark_usage(struct task_struct *curr, struct held_lock *hlock, int check)
{
return 1;
}
@@ -3833,11 +3842,8 @@ static int __lock_acquire(struct lockdep_map *lock, unsigned int subclass,
#endif
hlock->pin_count = pin_count;
if (check && !mark_irqflags(curr, hlock))
return 0;
/* mark it as used: */
if (!mark_lock(curr, hlock, LOCK_USED))
/* Initialize the lock usage bit */
if (!mark_usage(curr, hlock, check))
return 0;
/*