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.
Showing the changes to include/linux (2 of 5 files). Show all
Unified · Split
| @@ -6,16 +6,11 @@ · 5 unmodified lines | |||
| 6 | 6 | ||
| 7 | /* | 7 | /* |
| 8 | * rcuwait provides a way of blocking and waking up a single | 8 | * rcuwait provides a way of blocking and waking up a single |
| 9 | * task in an rcu-safe manner; where it is forbidden to use | 9 | * task in an rcu-safe manner. |
| 10 | * after exit_notify(). task_struct is not properly rcu protected, | ||
| 11 | * unless dealing with rcu-aware lists, ie: find_task_by_*(). | ||
| 12 | * | 10 | * |
| 13 | * Alternatively we have task_rcu_dereference(), but the return | 11 | * The only time @task is non-nil is when a user is blocked (or |
| 14 | * semantics have different implications which would break the | 12 | * checking if it needs to) on a condition, and reset as soon as we |
| 15 | * wakeup side. The only time @task is non-nil is when a user is | 13 | * know that the condition has succeeded and are awoken. |
| 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. | ||
| 19 | */ | 14 | */ |
| 20 | struct rcuwait { | 15 | struct rcuwait { |
| 21 | struct task_struct __rcu *task; | 16 | struct task_struct __rcu *task; |
| @@ -37,13 +32,6 @@ extern void rcuwait_wake_up(struct rcuwait *w); · 15 unmodified lines | |||
| 37 | */ | 32 | */ |
| 38 | #define rcuwait_wait_event(w, condition) \ | 33 | #define rcuwait_wait_event(w, condition) \ |
| 39 | ({ \ | 34 | ({ \ |
| 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 | \ | ||
| 47 | rcu_assign_pointer((w)->task, current); \ | 35 | rcu_assign_pointer((w)->task, current); \ |
| 48 | for (;;) { \ | 36 | for (;;) { \ |
| 49 | /* \ | 37 | /* \ |
| @@ -119,7 +119,6 @@ static inline void put_task_struct(struct task_struct *t) · 118 unmodified lines | |||
| 119 | __put_task_struct(t); | 119 | __put_task_struct(t); |
| 120 | } | 120 | } |
| 121 | 121 | ||
| 122 | struct task_struct *task_rcu_dereference(struct task_struct **ptask); | ||
| 123 | void put_task_struct_rcu_user(struct task_struct *task); | 122 | void put_task_struct_rcu_user(struct task_struct *task); |
| 124 | 123 | ||
| 125 | #ifdef CONFIG_ARCH_WANTS_DYNAMIC_TASK_STRUCT | 124 | #ifdef CONFIG_ARCH_WANTS_DYNAMIC_TASK_STRUCT |