From mboxrd@z Thu Jan 1 00:00:00 1970 From: Richard Palethorpe Date: Tue, 01 Jun 2021 11:42:48 +0100 Subject: [LTP] [PATCH v2 6/6] sched/cgroup: Add cfs_bandwidth01 In-Reply-To: References: <20210521102528.21102-1-rpalethorpe@suse.com> <20210521102528.21102-7-rpalethorpe@suse.com> <87k0njjj11.fsf@suse.de> Message-ID: <87h7ihkgrb.fsf@suse.de> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: ltp@lists.linux.it Hello Li, Li Wang writes: >> > > [root@dhcp-66-83-181 cfs-scheduler]# ./cfs_bandwidth01 >> > > tst_test.c:1313: TINFO: Timeout per run is 0h 05m 00s >> > > tst_buffers.c:55: TINFO: Test is using guarded buffers >> > > cfs_bandwidth01.c:48: TINFO: Set 'worker1/cpu.max' = '3000 10000' >> > > cfs_bandwidth01.c:48: TINFO: Set 'worker2/cpu.max' = '2000 10000' >> > > cfs_bandwidth01.c:48: TINFO: Set 'worker3/cpu.max' = '3000 10000' >> > > cfs_bandwidth01.c:111: TPASS: Scheduled bandwidth constrained workers >> > > cfs_bandwidth01.c:42: TBROK: >> > > vdprintf(10, >> > > 'cpu.cfs_quota_us', '%u'<5000>): EINVAL (22) >> > >> > I wonder if your kernel disallows setting this on a trunk node after it >> > has been set on leaf nodes (with or without procs in)? >> >> After looking a while, I think the CGrup V1 disallows the parent quota >> less than the max value of its children. >> >> This means we should set in level2 at least '3000/10000', just like what >> we did for level3. >> >> cfs_bandwidth01.c:48: TINFO: Set 'worker1/cpu.max' = '3000 10000' >> cfs_bandwidth01.c:48: TINFO: Set 'worker2/cpu.max' = '2000 10000' >> cfs_bandwidth01.c:48: TINFO: Set 'worker3/cpu.max' = '3000 10000' >> >> But in the failure, it shows level2 only set to 5000/100000 (far less than >> 3000/10000), that's because function set_cpu_quota changes the system >> default value 'cpu.cfs_period_us' from 100000 to 10000. > > Or, just reverse the code order to set cfs_period_us first, that also works. > > --- a/testcases/kernel/sched/cfs-scheduler/cfs_bandwidth01.c > +++ b/testcases/kernel/sched/cfs-scheduler/cfs_bandwidth01.c > @@ -38,10 +38,10 @@ static void set_cpu_quota(const struct > tst_cgroup_group *const cg, > SAFE_CGROUP_PRINTF(cg, "cpu.max", > "%u %u", quota_us, period_us); > } else { > - SAFE_CGROUP_PRINTF(cg, "cpu.max", > - "%u", quota_us); > SAFE_CGROUP_PRINTF(cg, "cpu.cfs_period_us", > "%u", period_us); > + SAFE_CGROUP_PRINTF(cg, "cpu.max", > + "%u", quota_us); > } Thanks, that is a nice fix. -- Thank you, Richard.