sched/trivial: Remove cfs bandwidth period check in tg_set_cfs_period()
PATCH 1/1 sched/trivial: Remove cfs bandwidth period check in tg_set_cfs_period()
sched: Remove cfs bandwidth period check in tg_set_cfs_period()
Remove cfs bandwidth period check from tg_set_cfs_period. Invalid bandwidth period's lower/upper limits are denoted by min_cfs_quota_period/max_cfs_quota_period repsectively, and are checked against valid period in tg_set_cfs_bandwidth().
Signature · 2 lines
kernel/sched/core.c | 3 --- 1 files changed, 0 insertions(+), 3 deletions(-)
kernel/sched/core.c +0 -3
@@ -7689,9 +7689,6 @@ int tg_set_cfs_period(struct task_group *tg, long cfs_period_us) period = (u64 )cfs_period_us *NSEC_PER_USEC ; quota = tg->cfs_bandwidth.quota; -if (period <=0 ) -return -EINVAL ; -return tg_set_cfs_bandwidth (tg, period, quota); }
Quoted 17 lines · Kamalesh Babulal
sched: Remove cfs bandwidth period check in
tg_set_cfs_period()Remove cfs bandwidth period check from
tg_set_cfs_period. Invalid bandwidth period's lower/upper limits are denoted by min_cfs_quota_period/max_cfs_quota_period repsectively, and are checked against valid period intg_set_cfs_bandwidth().Signed-off-by Kamalesh Babulal <[email protected]>Signature · 2 lines
kernel/sched/core.c | 3 --- 1 files changed, 0 insertions(+), 3 deletions(-)kernel/sched/core.c +0
-0
kernel/sched/core.c int tg_set_cfs_period(struct task_group *tg, long cfs_period_us) · line 7693
Quoted 8 lines
kernel/sched/core.c +0
-3@@ -7689,9 +7689,6 @@ int tg_set_cfs_period(struct task_group *tg, long cfs_period_us) period = (u64 )cfs_period_us *NSEC_PER_USEC ; quota = tg->cfs_bandwidth.quota; -if (period <=0 ) -return -EINVAL ; -return tg_set_cfs_bandwidth (tg, period, quota); }
There's a number of funnies here... it checks an unsigned value for <= 0, which suggests it wanted to check cfs_period_us, which is a signed value.
tg_set_cfs_bandwidth() has the same problem, at that point everything is unsigned and all below zero checks will fail.
Please reconsider things and see if this patch is still the right one.
Paul Turner
Acked-byQuoted 21 lines · Peter Zijlstra
Quoted 20 lines · Kamalesh Babulal
sched: Remove cfs bandwidth period check in
tg_set_cfs_period()Remove cfs bandwidth period check from
tg_set_cfs_period. Invalid bandwidth period's lower/upper limits are denoted by min_cfs_quota_period/max_cfs_quota_period repsectively, and are checked against valid period intg_set_cfs_bandwidth().Signed-off-by Kamalesh Babulal <[email protected]>--
kernel/sched/core.c | 3 ---1 files changed, 0 insertions(+), 3 deletions(-)kernel/sched/core.c +0
-0@@ -7689,9 +7689,6 @@ int tg_set_cfs_period(struct task_group *tg, long cfs_period_us) period = (u64)cfs_period_us * NSEC_PER_USEC; quota = tg->cfs_bandwidth.quota;
Quoted 9 lines
kernel/sched/core.c int tg_set_cfs_period(struct task_group *tg, long cfs_period_us) · line 7693
Quoted 5 lines
kernel/sched/core.c +0
-3- if (period <= 0) - return -EINVAL; - return tg_set_cfs_bandwidth(tg, period, quota); }There's a number of funnies here... it checks an unsigned value for <= 0, which suggests it wanted to check
cfs_period_us, which is a signed value.
Yup it wanted to check cfs_period0us -- although as Kamelesh points out, it can be omitted.
Quoted 5 lines
tg_set_cfs_bandwidth()has the same problem, at that point everything is unsigned and all below zero checks will fail.Please reconsider things and see if this patch is still the right one.
It's OK though since period is always strictly unsigned so any -ve becomes larger than the max allowed period and it spits out -EINVAL as appropriate.
So Kamelesh's patch above is good as is.
Quoted 8 lines · Paul Turner
It's OK though since period is always strictly unsigned so any -ve becomes larger than the max allowed period and it spits out
-EINVALas appropriate.So Kamelesh's patch above is good as is.
Acked-by Paul Turner <[email protected]>
Right you are, thanks!
[tip:sched/core] sched: Remove cfs bandwidth period check in tg_set_cfs_period()
In reply to Kamalesh BabulalCommit-ID: 11534ec5b6cea13ae38d31799d2a5290c5d724af Gitweb: http://git.kernel.org/tip/11534ec5b6cea13ae38d31799d2a5290c5d724af Author: Kamalesh Babulal <[email protected]> AuthorDate: Sat, 10 Dec 2011 19:29:25 +0530 Committer: Ingo Molnar <[email protected]> CommitDate: Wed, 21 Dec 2011 10:34:48 +0100
sched: Remove cfs bandwidth period check in tg_set_cfs_period()
Remove cfs bandwidth period check from tg_set_cfs_period. Invalid bandwidth period's lower/upper limits are denoted by min_cfs_quota_period/max_cfs_quota_period repsectively, and are checked against valid period in tg_set_cfs_bandwidth().
As pjt pointed out, negative input will result in very large unsigned numbers and will be caught by the max allowed period test.
--
kernel/sched/core.c | 3 --- 1 file changed, 3 deletions(-)
--- kernel/sched/core.c | 3 --- 1 files changed, 0 insertions(+), 3 deletions(-)
kernel/sched/core.c +0 -3
@@ -7714,9 +7714,6 @@ int tg_set_cfs_period(struct task_group *tg, long cfs_period_us) period = (u64 )cfs_period_us *NSEC_PER_USEC ; quota = tg->cfs_bandwidth.quota; -if (period <=0 ) -return -EINVAL ; -return tg_set_cfs_bandwidth (tg, period, quota); }