v2:
- Split into two patches per Peter's suggestion
- Patch 1: pure bug fix in sched_fork (restore timer_slack on reset)
- Patch 2: fix default_timer_slack_ns inheritance + init_task init
When an RT task with SCHED_RESET_ON_FORK creates child threads, the
children inherit timer_slack_ns=0 and can never recover a proper slack
value. This results in ~2x more timer interrupts than necessary.
Patch 1 fixes the immediate issue by restoring timer_slack_ns in
sched_fork() when resetting from RT to NORMAL policy.
Patch 2 fixes the root cause: copy_process() was overwriting the
child's default_timer_slack_ns with the parent's timer_slack_ns (0 for
RT), and init_task never initialized default_timer_slack_ns.
With both patches applied (RT parent, RESET_ON_FORK, 32 child threads
usleep(1)):
Before: child slack=0, avg_sleep=38us, ~832K interrupts/s
After: child slack=50000, avg_sleep=88us, ~363K interrupts/s
Guanyou.Chen (2):
sched: restore timer_slack_ns when resetting RT policy on fork
fork: fix default_timer_slack_ns inheritance from RT parent
init/init_task.c | 1 +
kernel/fork.c | 2 --
kernel/sched/core.c | 1 +
3 files changed, 2 insertions(+), 2 deletions(-)
--
2.34.1