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
6 6
7/*7/*
8 * rcuwait provides a way of blocking and waking up a single8 * rcuwait provides a way of blocking and waking up a single
9 * task in an rcu-safe manner; where it is forbidden to use9 * 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 return11 * The only time @task is non-nil is when a user is blocked (or
14 * semantics have different implications which would break the12 * 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 is13 * 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 */
20struct rcuwait {15struct 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 /* \
include/linux/sched/task.h+0−1
@@ -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
122struct task_struct *task_rcu_dereference(struct task_struct **ptask);
123void put_task_struct_rcu_user(struct task_struct *task);122void put_task_struct_rcu_user(struct task_struct *task);
124 123
125#ifdef CONFIG_ARCH_WANTS_DYNAMIC_TASK_STRUCT124#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