mirror of
https://github.com/torvalds/linux.git
synced 2026-09-25 21:21:09 -04:00
Remove work arounds that were written before there was a grace period after tasks left the runqueue in finish_task_switch(). In particular now that there tasks exiting the runqueue exprience a RCU grace period none of the work performed by task_rcu_dereference() excpet the rcu_dereference() is necessary so replace task_rcu_dereference() with rcu_dereference(). Remove the code in rcuwait_wait_event() that checks to ensure the current task has not exited. It is no longer necessary as it is guaranteed that any running task will experience a RCU grace period after it leaves the run queueue. Remove the comment in rcuwait_wake_up() as it is no longer relevant. Ref:8f95c90ceb("sched/wait, RCU: Introduce rcuwait machinery") Ref:150593bf86("sched/api: Introduce task_rcu_dereference() and try_get_task_struct()") Signed-off-by: Eric W. Biederman <[email protected]> Signed-off-by: Peter Zijlstra (Intel) <[email protected]> Cc: Chris Metcalf <[email protected]> Cc: Christoph Lameter <[email protected]> Cc: Davidlohr Bueso <[email protected]> Cc: Kirill Tkhai <[email protected]> Cc: Linus Torvalds <[email protected]> Cc: Mike Galbraith <[email protected]> Cc: Oleg Nesterov <[email protected]> Cc: Paul E. McKenney <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Russell King - ARM Linux admin <[email protected]> Cc: Thomas Gleixner <[email protected]> Link: https://lkml.kernel.org/r/[email protected] Signed-off-by: Ingo Molnar <[email protected]>
53 lines
1.2 KiB
C
53 lines
1.2 KiB
C
/* SPDX-License-Identifier: GPL-2.0 */
|
|
#ifndef _LINUX_RCUWAIT_H_
|
|
#define _LINUX_RCUWAIT_H_
|
|
|
|
#include <linux/rcupdate.h>
|
|
|
|
/*
|
|
* rcuwait provides a way of blocking and waking up a single
|
|
* task in an rcu-safe manner.
|
|
*
|
|
* The only time @task is non-nil is when a user is blocked (or
|
|
* checking if it needs to) on a condition, and reset as soon as we
|
|
* know that the condition has succeeded and are awoken.
|
|
*/
|
|
struct rcuwait {
|
|
struct task_struct __rcu *task;
|
|
};
|
|
|
|
#define __RCUWAIT_INITIALIZER(name) \
|
|
{ .task = NULL, }
|
|
|
|
static inline void rcuwait_init(struct rcuwait *w)
|
|
{
|
|
w->task = NULL;
|
|
}
|
|
|
|
extern void rcuwait_wake_up(struct rcuwait *w);
|
|
|
|
/*
|
|
* The caller is responsible for locking around rcuwait_wait_event(),
|
|
* such that writes to @task are properly serialized.
|
|
*/
|
|
#define rcuwait_wait_event(w, condition) \
|
|
({ \
|
|
rcu_assign_pointer((w)->task, current); \
|
|
for (;;) { \
|
|
/* \
|
|
* Implicit barrier (A) pairs with (B) in \
|
|
* rcuwait_wake_up(). \
|
|
*/ \
|
|
set_current_state(TASK_UNINTERRUPTIBLE); \
|
|
if (condition) \
|
|
break; \
|
|
\
|
|
schedule(); \
|
|
} \
|
|
\
|
|
WRITE_ONCE((w)->task, NULL); \
|
|
__set_current_state(TASK_RUNNING); \
|
|
})
|
|
|
|
#endif /* _LINUX_RCUWAIT_H_ */
|