All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH tip] sched/trivial: Remove cfs bandwidth period check in tg_set_cfs_period()
@ 2011-12-10 13:59 Kamalesh Babulal
  2011-12-12 13:05 ` Peter Zijlstra
  2011-12-21 11:43 ` [tip:sched/core] sched: " tip-bot for Kamalesh Babulal
  0 siblings, 2 replies; 5+ messages in thread
From: Kamalesh Babulal @ 2011-12-10 13:59 UTC (permalink / raw)
  To: linux-kernel; +Cc: Paul Turner, Peter Zijlstra, Ingo Molnar

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@linux.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);
 }
 


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH tip] sched/trivial: Remove cfs bandwidth period check in tg_set_cfs_period()
  2011-12-10 13:59 [PATCH tip] sched/trivial: Remove cfs bandwidth period check in tg_set_cfs_period() Kamalesh Babulal
@ 2011-12-12 13:05 ` Peter Zijlstra
  2011-12-13 12:40   ` Paul Turner
  2011-12-21 11:43 ` [tip:sched/core] sched: " tip-bot for Kamalesh Babulal
  1 sibling, 1 reply; 5+ messages in thread
From: Peter Zijlstra @ 2011-12-12 13:05 UTC (permalink / raw)
  To: Kamalesh Babulal; +Cc: linux-kernel, Paul Turner, Ingo Molnar

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@linux.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.

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.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH tip] sched/trivial: Remove cfs bandwidth period check in tg_set_cfs_period()
  2011-12-12 13:05 ` Peter Zijlstra
@ 2011-12-13 12:40   ` Paul Turner
  2011-12-13 12:53     ` Peter Zijlstra
  0 siblings, 1 reply; 5+ messages in thread
From: Paul Turner @ 2011-12-13 12:40 UTC (permalink / raw)
  To: Peter Zijlstra; +Cc: Kamalesh Babulal, linux-kernel, Ingo Molnar

On Mon, Dec 12, 2011 at 5:05 AM, Peter Zijlstra <a.p.zijlstra@chello.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@linux.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@google.com>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH tip] sched/trivial: Remove cfs bandwidth period check in tg_set_cfs_period()
  2011-12-13 12:40   ` Paul Turner
@ 2011-12-13 12:53     ` Peter Zijlstra
  0 siblings, 0 replies; 5+ messages in thread
From: Peter Zijlstra @ 2011-12-13 12:53 UTC (permalink / raw)
  To: Paul Turner; +Cc: Kamalesh Babulal, linux-kernel, Ingo Molnar

On Tue, 2011-12-13 at 04:40 -0800, Paul Turner wrote:
> 
> 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@google.com> 

Right you are, thanks!



^ permalink raw reply	[flat|nested] 5+ messages in thread

* [tip:sched/core] sched: Remove cfs bandwidth period check in tg_set_cfs_period()
  2011-12-10 13:59 [PATCH tip] sched/trivial: Remove cfs bandwidth period check in tg_set_cfs_period() Kamalesh Babulal
  2011-12-12 13:05 ` Peter Zijlstra
@ 2011-12-21 11:43 ` tip-bot for Kamalesh Babulal
  1 sibling, 0 replies; 5+ messages in thread
From: tip-bot for Kamalesh Babulal @ 2011-12-21 11:43 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, hpa, mingo, kamalesh, a.p.zijlstra, pjt, tglx,
	mingo

Commit-ID:  11534ec5b6cea13ae38d31799d2a5290c5d724af
Gitweb:     http://git.kernel.org/tip/11534ec5b6cea13ae38d31799d2a5290c5d724af
Author:     Kamalesh Babulal <kamalesh@linux.vnet.ibm.com>
AuthorDate: Sat, 10 Dec 2011 19:29:25 +0530
Committer:  Ingo Molnar <mingo@elte.hu>
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.

Signed-off-by: Kamalesh Babulal <kamalesh@linux.vnet.ibm.com>
Acked-by: Paul Turner <pjt@google.com>
[ammended changelog to mention negative values]
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/20111210135925.GA14593@linux.vnet.ibm.com
--
 kernel/sched/core.c |    3 ---
 1 file changed, 3 deletions(-)

Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
 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 dba878c..081ece2 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -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);
 }
 

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2011-12-21 11:43 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-12-10 13:59 [PATCH tip] sched/trivial: Remove cfs bandwidth period check in tg_set_cfs_period() Kamalesh Babulal
2011-12-12 13:05 ` Peter Zijlstra
2011-12-13 12:40   ` Paul Turner
2011-12-13 12:53     ` Peter Zijlstra
2011-12-21 11:43 ` [tip:sched/core] sched: " tip-bot for Kamalesh Babulal

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.