[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAPM31RKR8dvtSmMmV7xO5FnBgY62=fQugXYANNGYMOiAE6iQbg@mail.gmail.com>
Date: Tue, 13 Dec 2011 04:40:03 -0800
From: Paul Turner <pjt@...gle.com>
To: Peter Zijlstra <a.p.zijlstra@...llo.nl>
Cc: Kamalesh Babulal <kamalesh@...ux.vnet.ibm.com>,
linux-kernel@...r.kernel.org, Ingo Molnar <mingo@...e.hu>
Subject: Re: [PATCH tip] sched/trivial: Remove cfs bandwidth period check in tg_set_cfs_period()
On Mon, Dec 12, 2011 at 5:05 AM, Peter Zijlstra <a.p.zijlstra@...llo.nl> wrote:
> On Sat, 2011-12-10 at 19:29 +0530, Kamalesh Babulal wrote:
>> 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().
>>
>> Signed-off-by: Kamalesh Babulal <kamalesh@...ux.vnet.ibm.com>
>> --
>> kernel/sched/core.c | 3 ---
>> 1 files changed, 0 insertions(+), 3 deletions(-)
>>
>> diff --git a/kernel/sched/core.c b/kernel/sched/core.c
>> index 3c5b21e..57cf3ab 100644
>> --- a/kernel/sched/core.c
>> +++ b/kernel/sched/core.c
>> @@ -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.
Yup it wanted to check cfs_period0us -- although as Kamelesh points
out, it can be omitted.
>
> 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.
Acked-by: Paul Turner <pjt@...gle.com>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists