Re: [PATCH 0/2] cgroup cpu: set burst to zero when cfs bandwidth is

From: Vishal Chourasia
Date: Fri May 24 2024 - 06:53:40 EST


On Wed, May 22, 2024 at 11:10:05AM +0800, Cheng Yu wrote:
> In the cgroup cpu subsystem, when we remove the restriction on cfs
> bandwidth, the burst feature is also turned off. At that time, we expect
> that the value of burst is zero.
>
> Patch 1 fixes it in cgroup v1 by Zhao Wenhui and patch 2 fixes it in
> cgroup v2.
>
> Cheng Yu (1):
> sched/fair: set burst to zero when set max to cpu.max
>
> Zhao Wenhui (1):
> sched/fair: limit burst to zero when cfs bandwidth is turned off
>

## Before patch
# uname -r
6.9.0-12124-g6d69b6c12fce-dirty
# mkdir test
# cd test/
# cat cpu.max cpu.max.burst
max 100000
0
# echo 10000000 > cpu.max.burst
# echo 1000000000000 > cpu.max.burst
# cat cpu.max cpu.max.burst
max 100000
1000000000000
# echo "1000 100000" > cpu.max
-bash: echo: write error: Invalid argument
# echo 1000 > cpu.max.burst
# echo "1000 100000" > cpu.max
# cat cpu.max cpu.max.burst
1000 100000
1000

## After patch

# uname -r
6.9.0-12126-g7eb1a247b675-dirty
# mkdir test
# cd test/
# cat cpu.max cpu.max.burst
max 100000
0
# echo 1134535435 > cpu.max.burst
-bash: echo: write error: Invalid argument
# echo 1 > cpu.max.burst
-bash: echo: write error: Invalid argument
# echo -1 > cpu.max.burst
-bash: echo: write error: Invalid argument
# echo "10000 100000" > cpu.max
# echo 1000 > cpu.max.burst
# cat cpu.max cpu.max.burst
10000 100000
1000
# echo "max 100000" > cpu.max
# cat cpu.max cpu.max.burst
max 100000
0

# git log --oneline
7eb1a247b6753 (HEAD) sched/fair: set burst to zero when set max to cpu.max
421647086da9e sched/fair: limit burst to zero when cfs bandwidth is turned off
6d69b6c12fce4 (origin/master, origin/HEAD, master) Merge tag 'nfs-for-6.10-1' o

Now, the burst value can only be set after setting
the quota. This change also prevents setting excessively
large burst values.

Thank you the fix.

Tested-by: Vishal Chourasia <vishalc@xxxxxxxxxxxxx>

> kernel/sched/core.c | 15 +++++++++++++--
> 1 file changed, 13 insertions(+), 2 deletions(-)
>
> --
> 2.25.1
>