History

locking/ww_mutex: Simplify lockdep annotations

No functional change.

Peter Zijlstra committed 5 years ago

Commit cf702ed1 parent ebf4c551 file · +10 −9Browse files

Showing the changes to kernel (1 of 1 file). Show all

Unified · Split

kernel/locking/mutex.c+10−9
@@ -951,6 +951,10 @@ __mutex_lock_common(struct mutex *lock, unsigned int state, unsigned int subclas · 950 unmodified lines
951 */951 */
952 if (ww_ctx->acquired == 0)952 if (ww_ctx->acquired == 0)
953 ww_ctx->wounded = 0;953 ww_ctx->wounded = 0;
954
955#ifdef CONFIG_DEBUG_LOCK_ALLOC
956 nest_lock = &ww_ctx->dep_map;
957#endif
954 }958 }
955 959
956 preempt_disable();960 preempt_disable();
@@ -1098,10 +1102,9 @@ __mutex_lock(struct mutex *lock, unsigned int state, unsigned int subclass, · 141 unmodified lines
1098 1102
1099static int __sched1103static int __sched
1100__ww_mutex_lock(struct mutex *lock, unsigned int state, unsigned int subclass,1104__ww_mutex_lock(struct mutex *lock, unsigned int state, unsigned int subclass,
1101 struct lockdep_map *nest_lock, unsigned long ip,1105 unsigned long ip, struct ww_acquire_ctx *ww_ctx)
1102 struct ww_acquire_ctx *ww_ctx)
1103{1106{
1104 return __mutex_lock_common(lock, state, subclass, nest_lock, ip, ww_ctx, true);1107 return __mutex_lock_common(lock, state, subclass, NULL, ip, ww_ctx, true);
1105}1108}
1106 1109
1107#ifdef CONFIG_DEBUG_LOCK_ALLOC1110#ifdef CONFIG_DEBUG_LOCK_ALLOC
@@ -1181,8 +1184,7 @@ ww_mutex_lock(struct ww_mutex *lock, struct ww_acquire_ctx *ctx) · 73 unmodified lines
1181 1184
1182 might_sleep();1185 might_sleep();
1183 ret = __ww_mutex_lock(&lock->base, TASK_UNINTERRUPTIBLE,1186 ret = __ww_mutex_lock(&lock->base, TASK_UNINTERRUPTIBLE,
1184 0, ctx ? &ctx->dep_map : NULL, _RET_IP_,1187 0, _RET_IP_, ctx);
1185 ctx);
1186 if (!ret && ctx && ctx->acquired > 1)1188 if (!ret && ctx && ctx->acquired > 1)
1187 return ww_mutex_deadlock_injection(lock, ctx);1189 return ww_mutex_deadlock_injection(lock, ctx);
1188 1190
@@ -1197,8 +1199,7 @@ ww_mutex_lock_interruptible(struct ww_mutex *lock, struct ww_acquire_ctx *ctx) · 8 unmodified lines
1197 1199
1198 might_sleep();1200 might_sleep();
1199 ret = __ww_mutex_lock(&lock->base, TASK_INTERRUPTIBLE,1201 ret = __ww_mutex_lock(&lock->base, TASK_INTERRUPTIBLE,
1200 0, ctx ? &ctx->dep_map : NULL, _RET_IP_,1202 0, _RET_IP_, ctx);
1201 ctx);
1202 1203
1203 if (!ret && ctx && ctx->acquired > 1)1204 if (!ret && ctx && ctx->acquired > 1)
1204 return ww_mutex_deadlock_injection(lock, ctx);1205 return ww_mutex_deadlock_injection(lock, ctx);
@@ -1364,7 +1365,7 @@ __mutex_lock_interruptible_slowpath(struct mutex *lock) · 159 unmodified lines
1364static noinline int __sched1365static noinline int __sched
1365__ww_mutex_lock_slowpath(struct ww_mutex *lock, struct ww_acquire_ctx *ctx)1366__ww_mutex_lock_slowpath(struct ww_mutex *lock, struct ww_acquire_ctx *ctx)
1366{1367{
1367 return __ww_mutex_lock(&lock->base, TASK_UNINTERRUPTIBLE, 0, NULL,1368 return __ww_mutex_lock(&lock->base, TASK_UNINTERRUPTIBLE, 0,
1368 _RET_IP_, ctx);1369 _RET_IP_, ctx);
1369}1370}
1370 1371
@@ -1372,7 +1373,7 @@ static noinline int __sched · 1 unmodified line
1372__ww_mutex_lock_interruptible_slowpath(struct ww_mutex *lock,1373__ww_mutex_lock_interruptible_slowpath(struct ww_mutex *lock,
1373 struct ww_acquire_ctx *ctx)1374 struct ww_acquire_ctx *ctx)
1374{1375{
1375 return __ww_mutex_lock(&lock->base, TASK_INTERRUPTIBLE, 0, NULL,1376 return __ww_mutex_lock(&lock->base, TASK_INTERRUPTIBLE, 0,
1376 _RET_IP_, ctx);1377 _RET_IP_, ctx);
1377}1378}
1378 1379

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t