[RFC,0/2] sched/fair: Delay throttling to kernel exit

Message ID 20231130161245.3894682-1-vschneid@redhat.com
Headers
Series sched/fair: Delay throttling to kernel exit |

Message

Valentin Schneider Nov. 30, 2023, 4:12 p.m. UTC
  Hi folks

I apologize for the one-big-patch-to-rule-them-all, I tried splitting but I
couldn't get to anything that made sense, so it's one big patch and a small
follow-up.

TL;DR of what I'd like to hear about:
o Is there interest in getting this in for !PREEMPT_RT reasons?
o Any ideas on how to make cgroup migration less horrible so we can fully pop
  out the throttled cfs_rq se's?

Survives a good hour of my testing below on a 4-CPU QEMU system, but I expect
the throttled clocks & PELT to be busted. 
  
Testing
=======

setup
+++++
mount -t cgroup -o cpu none /root/cpu

mkdir /root/cpu/cg0
echo 10000 >  /root/cpu/cg0/cpu.cfs_period_us
echo 1000 > /root/cpu/cg0/cpu.cfs_quota_us

mkdir /root/cpu/cg0/cg00
mkdir /root/cpu/cg0/cg01

mkdir /root/cpu/cg0/cg00/cg000
mkdir /root/cpu/cg0/cg00/cg001

read.sh
+++++++
while true; do cat /sys/devices/system/cpu/smt/active &>/dev/null; done

repro.sh
++++++++
spawn() {
    ./read.sh &
    PID=$!
    echo "Tracing PID${PID}"
    echo $PID > $1
}

spawn cpu/cg0/tasks
spawn cpu/cg0/tasks
spawn cpu/cg0/tasks
spawn cpu/cg0/tasks

spawn cpu/cg0/cg01/tasks

spawn cpu/cg0/cg00/cg000/tasks
spawn cpu/cg0/cg00/cg001/tasks

sleep 1

kill $(jobs -p)

Valentin Schneider (2):
  sched/fair: Only throttle CFS tasks on return to userspace
  sched/fair: Repurpose cfs_rq_throttled()

 include/linux/sched.h |   2 +
 kernel/sched/core.c   |   6 +-
 kernel/sched/debug.c  |   4 +-
 kernel/sched/fair.c   | 296 +++++++++++++++++++++++++++---------------
 kernel/sched/sched.h  |   8 +-
 5 files changed, 204 insertions(+), 112 deletions(-)

--
2.41.0