mirror of
https://gitee.com/bianbu-linux/linux-6.6
synced 2025-04-26 14:17:26 -04:00
locking/ww_mutex: Gather mutex_waiter initialization
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Signed-off-by: Ingo Molnar <mingo@kernel.org> Link: https://lore.kernel.org/r/20210815211304.281927514@linutronix.de
This commit is contained in:
parent
cf702eddcd
commit
c0afb0ffc0
2 changed files with 4 additions and 9 deletions
|
@ -30,6 +30,7 @@ void debug_mutex_lock_common(struct mutex *lock, struct mutex_waiter *waiter)
|
||||||
memset(waiter, MUTEX_DEBUG_INIT, sizeof(*waiter));
|
memset(waiter, MUTEX_DEBUG_INIT, sizeof(*waiter));
|
||||||
waiter->magic = waiter;
|
waiter->magic = waiter;
|
||||||
INIT_LIST_HEAD(&waiter->list);
|
INIT_LIST_HEAD(&waiter->list);
|
||||||
|
waiter->ww_ctx = MUTEX_POISON_WW_CTX;
|
||||||
}
|
}
|
||||||
|
|
||||||
void debug_mutex_wake_waiter(struct mutex *lock, struct mutex_waiter *waiter)
|
void debug_mutex_wake_waiter(struct mutex *lock, struct mutex_waiter *waiter)
|
||||||
|
|
|
@ -982,17 +982,15 @@ __mutex_lock_common(struct mutex *lock, unsigned int state, unsigned int subclas
|
||||||
}
|
}
|
||||||
|
|
||||||
debug_mutex_lock_common(lock, &waiter);
|
debug_mutex_lock_common(lock, &waiter);
|
||||||
|
waiter.task = current;
|
||||||
|
if (ww_ctx)
|
||||||
|
waiter.ww_ctx = ww_ctx;
|
||||||
|
|
||||||
lock_contended(&lock->dep_map, ip);
|
lock_contended(&lock->dep_map, ip);
|
||||||
|
|
||||||
if (!use_ww_ctx) {
|
if (!use_ww_ctx) {
|
||||||
/* add waiting tasks to the end of the waitqueue (FIFO): */
|
/* add waiting tasks to the end of the waitqueue (FIFO): */
|
||||||
__mutex_add_waiter(lock, &waiter, &lock->wait_list);
|
__mutex_add_waiter(lock, &waiter, &lock->wait_list);
|
||||||
|
|
||||||
|
|
||||||
#ifdef CONFIG_DEBUG_MUTEXES
|
|
||||||
waiter.ww_ctx = MUTEX_POISON_WW_CTX;
|
|
||||||
#endif
|
|
||||||
} else {
|
} else {
|
||||||
/*
|
/*
|
||||||
* Add in stamp order, waking up waiters that must kill
|
* Add in stamp order, waking up waiters that must kill
|
||||||
|
@ -1001,12 +999,8 @@ __mutex_lock_common(struct mutex *lock, unsigned int state, unsigned int subclas
|
||||||
ret = __ww_mutex_add_waiter(&waiter, lock, ww_ctx);
|
ret = __ww_mutex_add_waiter(&waiter, lock, ww_ctx);
|
||||||
if (ret)
|
if (ret)
|
||||||
goto err_early_kill;
|
goto err_early_kill;
|
||||||
|
|
||||||
waiter.ww_ctx = ww_ctx;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
waiter.task = current;
|
|
||||||
|
|
||||||
set_current_state(state);
|
set_current_state(state);
|
||||||
for (;;) {
|
for (;;) {
|
||||||
bool first;
|
bool first;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue