Message ID | 1429851274-24879-1-git-send-email-gwshan@linux.vnet.ibm.com |
---|---|
State | Accepted |
Headers | show |
diff --git a/core/lock.c b/core/lock.c index ac6cb3b..fbf2d87 100644 --- a/core/lock.c +++ b/core/lock.c @@ -120,15 +120,13 @@ bool lock_recursive(struct lock *l) if (bust_locks) return false; - if ((l->lock_val & 1) && - (l->lock_val >> 32) == this_cpu()->pir) + if (lock_held_by_me(l)) return false; lock(l); return true; } - void init_locks(void) { bust_locks = false;
In lock_recursive(), the condition, used to check if the lock has been held by current CPU, can be replaced with lock_held_by_me() to simplify the code. Signed-off-by: Gavin Shan <gwshan@linux.vnet.ibm.com> --- core/lock.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)