Skip to content

sched/fair: Fix starvation caused by task migration

Tim Chen lkml oe-lkp 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest2 patches 7 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2sched/fair: Don't rely on ->exec_start for migrationinclude/linux/sched.h kernel/sched/fair.c+6 -10 replies
2/2sched/fair: Simple runqueue order on migratekernel/sched/fair.c kernel/sched/features.h+31 -47 replies

Reviews trailers per patch

None of the 2 patches has a Reviewed-by or Acked-by.

PatchChen YuWalter Mack
1/2
2/2T-b T-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [PATCH 0/2] sched/fair: Fix starvation caused by task migration

Walter Mack noticed during stress testing on 2 socket Sapphire Rapids system, there were anomalies where tasks were starved for more than 70 secs before getting scheduled.

The stress test scenario is an extreme case where about 50 threads per CPU are started on each core. Then each thread hops from one core to another continuously.

We discussed this issue with Peter Z., who narrowed things down to problem with vruntime setting of a migrated task being too out of sync with the tasks on the target run queue.

Peter suggested the following two patches that did fix the starvation anomalies that Walter saw.

Yu Chen also kicked the patches into our 0-day test infrastructure to check for regressions. The performance changes of note are below:

5.15 Throughput 5.15+patchest Test
Changes
4634070 -7.5% 4285823 stress-ng.sigsuspend.ops_per_sec
29934 +37.0% 41006 aim7.jobs-per-min

Stress-ng sigsuspend is the worst affected. But for most workloads, they are not negatively impacted. In fact, we saw 37% improvement in Aim7 due to these patches.

Tim

Peter Zijlstra (1):
sched/fair: Don't rely on ->exec_start for migration

Peter Zijlstra (Intel) (1):
sched/fair: Simple runqueue order on migrate

 include/linux/sched.h   |  1 +
 kernel/sched/fair.c     | 37 +++++++++++++++++++++++++++++++++----
 kernel/sched/features.h |  2 ++
 3 files changed, 36 insertions(+), 4 deletions(-)
Signature · 1 line
2.32.0