Commit c006fac
sched: Warn on long periods of pending need_resched
CPU scheduler marks need_resched flag to signal a schedule() on a
particular CPU. But, schedule() may not happen immediately in cases
where the current task is executing in the kernel mode (no
preemption state) for extended periods of time.
This patch adds a warn_on if need_resched is pending for more than the
time specified in sysctl resched_latency_warn_ms. If it goes off, it is
likely that there is a missing cond_resched() somewhere. Monitoring is
done via the tick and the accuracy is hence limited to jiffy scale. This
also means that we won't trigger the warning if the tick is disabled.
This feature (LATENCY_WARN) is default disabled.
Signed-off-by: Paul Turner <pjt@google.com>
Signed-off-by: Josh Don <joshdon@google.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://lkml.kernel.org/r/20210416212936.390566-1-joshdon@google.com1 parent 3f5ad91 commit c006fac
File tree
5 files changed
+97
-1
lines changed- include/linux/sched
- kernel/sched
5 files changed
+97
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
48 | 48 | | |
49 | 49 | | |
50 | 50 | | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
51 | 54 | | |
52 | 55 | | |
53 | 56 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
58 | 58 | | |
59 | 59 | | |
60 | 60 | | |
61 | | - | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
62 | 72 | | |
63 | 73 | | |
64 | 74 | | |
| |||
4527 | 4537 | | |
4528 | 4538 | | |
4529 | 4539 | | |
| 4540 | + | |
| 4541 | + | |
| 4542 | + | |
| 4543 | + | |
| 4544 | + | |
| 4545 | + | |
| 4546 | + | |
| 4547 | + | |
| 4548 | + | |
| 4549 | + | |
| 4550 | + | |
| 4551 | + | |
| 4552 | + | |
| 4553 | + | |
| 4554 | + | |
| 4555 | + | |
| 4556 | + | |
| 4557 | + | |
| 4558 | + | |
| 4559 | + | |
| 4560 | + | |
| 4561 | + | |
| 4562 | + | |
| 4563 | + | |
| 4564 | + | |
| 4565 | + | |
| 4566 | + | |
| 4567 | + | |
| 4568 | + | |
| 4569 | + | |
| 4570 | + | |
| 4571 | + | |
| 4572 | + | |
| 4573 | + | |
| 4574 | + | |
| 4575 | + | |
| 4576 | + | |
| 4577 | + | |
| 4578 | + | |
| 4579 | + | |
| 4580 | + | |
| 4581 | + | |
| 4582 | + | |
| 4583 | + | |
| 4584 | + | |
| 4585 | + | |
| 4586 | + | |
| 4587 | + | |
| 4588 | + | |
4530 | 4589 | | |
4531 | 4590 | | |
4532 | 4591 | | |
| |||
4538 | 4597 | | |
4539 | 4598 | | |
4540 | 4599 | | |
| 4600 | + | |
4541 | 4601 | | |
4542 | 4602 | | |
4543 | 4603 | | |
| |||
4548 | 4608 | | |
4549 | 4609 | | |
4550 | 4610 | | |
| 4611 | + | |
| 4612 | + | |
4551 | 4613 | | |
4552 | 4614 | | |
4553 | 4615 | | |
4554 | 4616 | | |
| 4617 | + | |
| 4618 | + | |
| 4619 | + | |
4555 | 4620 | | |
4556 | 4621 | | |
4557 | 4622 | | |
| |||
5046 | 5111 | | |
5047 | 5112 | | |
5048 | 5113 | | |
| 5114 | + | |
| 5115 | + | |
| 5116 | + | |
5049 | 5117 | | |
5050 | 5118 | | |
5051 | 5119 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
309 | 309 | | |
310 | 310 | | |
311 | 311 | | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
312 | 315 | | |
313 | 316 | | |
314 | 317 | | |
| |||
1027 | 1030 | | |
1028 | 1031 | | |
1029 | 1032 | | |
| 1033 | + | |
| 1034 | + | |
| 1035 | + | |
| 1036 | + | |
| 1037 | + | |
| 1038 | + | |
| 1039 | + | |
| 1040 | + | |
| 1041 | + | |
| 1042 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
91 | 91 | | |
92 | 92 | | |
93 | 93 | | |
| 94 | + | |
| 95 | + | |
94 | 96 | | |
95 | 97 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
58 | 58 | | |
59 | 59 | | |
60 | 60 | | |
| 61 | + | |
61 | 62 | | |
62 | 63 | | |
63 | 64 | | |
| |||
971 | 972 | | |
972 | 973 | | |
973 | 974 | | |
| 975 | + | |
| 976 | + | |
| 977 | + | |
| 978 | + | |
| 979 | + | |
974 | 980 | | |
975 | 981 | | |
976 | 982 | | |
| |||
2371 | 2377 | | |
2372 | 2378 | | |
2373 | 2379 | | |
| 2380 | + | |
| 2381 | + | |
2374 | 2382 | | |
2375 | 2383 | | |
2376 | 2384 | | |
2377 | 2385 | | |
2378 | 2386 | | |
2379 | 2387 | | |
2380 | 2388 | | |
| 2389 | + | |
| 2390 | + | |
2381 | 2391 | | |
2382 | 2392 | | |
2383 | 2393 | | |
| |||
0 commit comments