History

tasks, sched/core: With a grace period after finish_task_switch(), remove unnecessary code

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.

Eric W. Biederman committed 7 years ago

Commit 154abaf1 parent 0ff7b2c5 files · +7 −87Browse files

Showing the changes to include/linux (2 of 5 files). Show all

Unified · Split

2 files
  1. include/linux/rcuwait.h +4 −16
  2. include/linux/sched/task.h +0 −1
include/linux/rcuwait.h+4−16
@@ -6,16 +6,11 @@ · 5 unmodified lines
66
77 /*
88 * rcuwait provides a way of blocking and waking up a single
9− * task in an rcu-safe manner; where it is forbidden to use
10− * after exit_notify(). task_struct is not properly rcu protected,
11− * unless dealing with rcu-aware lists, ie: find_task_by_*().
9+ * task in an rcu-safe manner.
1210 *
13− * Alternatively we have task_rcu_dereference(), but the return
14− * semantics have different implications which would break the
15− * wakeup side. The only time @task is non-nil is when a user is
16− * blocked (or checking if it needs to) on a condition, and reset
17− * as soon as we know that the condition has succeeded and are
18− * awoken.
11+ * The only time @task is non-nil is when a user is blocked (or
12+ * checking if it needs to) on a condition, and reset as soon as we
13+ * know that the condition has succeeded and are awoken.
1914 */
2015 struct rcuwait {
2116 struct task_struct __rcu *task;
@@ -37,13 +32,6 @@ extern void rcuwait_wake_up(struct rcuwait *w); · 15 unmodified lines
3732 */
3833 #define rcuwait_wait_event(w, condition) \
3934 ({ \
40− /* \
41− * Complain if we are called after do_exit()/exit_notify(), \
42− * as we cannot rely on the rcu critical region for the \
43− * wakeup side. \
44− */ \
45− WARN_ON(current->exit_state); \
46− \
4735 rcu_assign_pointer((w)->task, current); \
4836 for (;;) { \
4937 /* \
include/linux/sched/task.h+0−1
@@ -119,7 +119,6 @@ static inline void put_task_struct(struct task_struct *t) · 118 unmodified lines
119119 __put_task_struct(t);
120120 }
121121
122−struct task_struct *task_rcu_dereference(struct task_struct **ptask);
123122 void put_task_struct_rcu_user(struct task_struct *task);
124123
125124 #ifdef CONFIG_ARCH_WANTS_DYNAMIC_TASK_STRUCT

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