Commit 0d40a6d
perf: Move swevent_htable::recursion into task_struct.
The swevent_htable::recursion counter is used to avoid creating an
swevent while an event is processed to avoid recursion. The counter is
per-CPU and preemption must be disabled to have a stable counter.
perf_pending_task() disables preemption to access the counter and then
signal. This is problematic on PREEMPT_RT because sending a signal uses
a spinlock_t which must not be acquired in atomic on PREEMPT_RT because
it becomes a sleeping lock.
The atomic context can be avoided by moving the counter into the
task_struct. There is a 4 byte hole between futex_state (usually always
on) and the following perf pointer (perf_event_ctxp). After the
recursion lost some weight it fits perfectly.
Move swevent_htable::recursion into task_struct.
Signed-off-by: Sebastian Andrzej Siewior <[email protected]>
Signed-off-by: Peter Zijlstra (Intel) <[email protected]>
Tested-by: Marco Elver <[email protected]>
Link: https://lore.kernel.org/r/[email protected]1 parent 5af42f9 commit 0d40a6d
File tree
4 files changed
+11
-17
lines changed- include/linux
- kernel/events
4 files changed
+11
-17
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
970 | 970 | | |
971 | 971 | | |
972 | 972 | | |
973 | | - | |
974 | | - | |
975 | | - | |
976 | | - | |
977 | | - | |
978 | | - | |
979 | 973 | | |
980 | 974 | | |
981 | 975 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
734 | 734 | | |
735 | 735 | | |
736 | 736 | | |
| 737 | + | |
| 738 | + | |
| 739 | + | |
| 740 | + | |
| 741 | + | |
| 742 | + | |
737 | 743 | | |
738 | 744 | | |
739 | 745 | | |
| |||
1256 | 1262 | | |
1257 | 1263 | | |
1258 | 1264 | | |
| 1265 | + | |
1259 | 1266 | | |
1260 | 1267 | | |
1261 | 1268 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9763 | 9763 | | |
9764 | 9764 | | |
9765 | 9765 | | |
9766 | | - | |
9767 | | - | |
9768 | | - | |
9769 | 9766 | | |
9770 | | - | |
9771 | 9767 | | |
9772 | 9768 | | |
9773 | 9769 | | |
| |||
9965 | 9961 | | |
9966 | 9962 | | |
9967 | 9963 | | |
9968 | | - | |
9969 | | - | |
9970 | | - | |
| 9964 | + | |
9971 | 9965 | | |
9972 | 9966 | | |
9973 | 9967 | | |
9974 | 9968 | | |
9975 | 9969 | | |
9976 | | - | |
9977 | | - | |
9978 | | - | |
| 9970 | + | |
9979 | 9971 | | |
9980 | 9972 | | |
9981 | 9973 | | |
| |||
13642 | 13634 | | |
13643 | 13635 | | |
13644 | 13636 | | |
| 13637 | + | |
13645 | 13638 | | |
13646 | 13639 | | |
13647 | 13640 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
221 | 221 | | |
222 | 222 | | |
223 | 223 | | |
224 | | - | |
| 224 | + | |
225 | 225 | | |
226 | 226 | | |
227 | 227 | | |
| |||
0 commit comments