Commit 97e047f
trace/pid_list: optimize pid_list->lock contention
When the system has many cores and task switching is frequent,
setting set_ftrace_pid can cause frequent pid_list->lock contention
and high system sys usage.
For example, in a 288-core VM environment, we observed 267 CPUs
experiencing contention on pid_list->lock, with stack traces showing:
#4 [ffffa6226fb4bc70] native_queued_spin_lock_slowpath at ffffffff99cd4b7e
#5 [ffffa6226fb4bc90] _raw_spin_lock_irqsave at ffffffff99cd3e36
#6 [ffffa6226fb4bca0] trace_pid_list_is_set at ffffffff99267554
#7 [ffffa6226fb4bcc0] trace_ignore_this_task at ffffffff9925c288
#8 [ffffa6226fb4bcd8] ftrace_filter_pid_sched_switch_probe at ffffffff99246efe
#9 [ffffa6226fb4bcf0] __schedule at ffffffff99ccd161
Replaces the existing spinlock with a seqlock to allow concurrent readers,
while maintaining write exclusivity.
Link: https://patch.msgid.link/[email protected]
Reviewed-by: Huang Cun <[email protected]>
Signed-off-by: Yongliang Gao <[email protected]>
Signed-off-by: Steven Rostedt (Google) <[email protected]>1 parent e29aa91 commit 97e047f
2 files changed
+22
-9
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| 6 | + | |
6 | 7 | | |
7 | 8 | | |
8 | 9 | | |
| |||
126 | 127 | | |
127 | 128 | | |
128 | 129 | | |
129 | | - | |
| 130 | + | |
130 | 131 | | |
131 | 132 | | |
132 | 133 | | |
| |||
138 | 139 | | |
139 | 140 | | |
140 | 141 | | |
141 | | - | |
142 | | - | |
143 | | - | |
144 | | - | |
145 | | - | |
146 | | - | |
147 | | - | |
148 | | - | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
149 | 152 | | |
150 | 153 | | |
151 | 154 | | |
| |||
178 | 181 | | |
179 | 182 | | |
180 | 183 | | |
| 184 | + | |
181 | 185 | | |
182 | 186 | | |
183 | 187 | | |
| |||
199 | 203 | | |
200 | 204 | | |
201 | 205 | | |
| 206 | + | |
202 | 207 | | |
203 | 208 | | |
204 | 209 | | |
| |||
230 | 235 | | |
231 | 236 | | |
232 | 237 | | |
| 238 | + | |
233 | 239 | | |
234 | 240 | | |
235 | 241 | | |
| |||
250 | 256 | | |
251 | 257 | | |
252 | 258 | | |
| 259 | + | |
253 | 260 | | |
254 | 261 | | |
255 | 262 | | |
| |||
340 | 347 | | |
341 | 348 | | |
342 | 349 | | |
| 350 | + | |
343 | 351 | | |
344 | 352 | | |
| 353 | + | |
345 | 354 | | |
346 | 355 | | |
347 | 356 | | |
| |||
370 | 379 | | |
371 | 380 | | |
372 | 381 | | |
| 382 | + | |
373 | 383 | | |
374 | 384 | | |
375 | 385 | | |
| |||
380 | 390 | | |
381 | 391 | | |
382 | 392 | | |
| 393 | + | |
383 | 394 | | |
384 | 395 | | |
385 | 396 | | |
| |||
419 | 430 | | |
420 | 431 | | |
421 | 432 | | |
| 433 | + | |
422 | 434 | | |
423 | 435 | | |
424 | 436 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
76 | 76 | | |
77 | 77 | | |
78 | 78 | | |
| 79 | + | |
79 | 80 | | |
80 | 81 | | |
81 | 82 | | |
| |||
0 commit comments