* [PATCH] cpuset: limit the input of cpuset.sched_relax_domain_level
@ 2008-05-13 2:27 Li Zefan
2008-05-13 2:29 ` Paul Menage
` (2 more replies)
0 siblings, 3 replies; 7+ messages in thread
From: Li Zefan @ 2008-05-13 2:27 UTC (permalink / raw)
To: Andrew Morton
Cc: Paul Jackson, Hidetoshi Seto, Paul Menage, Ingo Molnar, LKML
We allow the inputs to be [-1 ... SD_LV_MAX), and return -EINVAL
for inputs outside this range.
Signed-off-by: Li Zefan <lizf@cn.fujitsu.com>
---
Documentation/cpusets.txt | 2 +-
kernel/cpuset.c | 4 ++--
kernel/sched.c | 7 ++++++-
3 files changed, 9 insertions(+), 4 deletions(-)
diff --git a/Documentation/cpusets.txt b/Documentation/cpusets.txt
index fb7b361..9066ce7 100644
--- a/Documentation/cpusets.txt
+++ b/Documentation/cpusets.txt
@@ -542,7 +542,7 @@ otherwise initial value -1 that indicates the cpuset has no request.
2 : search cores in a package.
3 : search cpus in a node [= system wide on non-NUMA system]
( 4 : search nodes in a chunk of node [on NUMA system] )
- ( 5~ : search system wide [on NUMA system])
+ ( 5 : search system wide [on NUMA system] )
This file is per-cpuset and affect the sched domain where the cpuset
belongs to. Therefore if the flag 'sched_load_balance' of a cpuset
diff --git a/kernel/cpuset.c b/kernel/cpuset.c
index 86ea9e3..c192213 100644
--- a/kernel/cpuset.c
+++ b/kernel/cpuset.c
@@ -1033,8 +1033,8 @@ int current_cpuset_is_being_rebound(void)
static int update_relax_domain_level(struct cpuset *cs, s64 val)
{
- if ((int)val < 0)
- val = -1;
+ if (val < -1 || val >= SD_LV_MAX)
+ return -EINVAL;
if (val != cs->relax_domain_level) {
cs->relax_domain_level = val;
diff --git a/kernel/sched.c b/kernel/sched.c
index 8841a91..24d499e 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -7219,7 +7219,12 @@ static int default_relax_domain_level = -1;
static int __init setup_relax_domain_level(char *str)
{
- default_relax_domain_level = simple_strtoul(str, NULL, 0);
+ unsigned long val;
+
+ val = simple_strtoul(str, NULL, 0);
+ if (val < SD_LV_MAX)
+ default_relax_domain_level = val;
+
return 1;
}
__setup("relax_domain_level=", setup_relax_domain_level);
--
1.5.4.rc3
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH] cpuset: limit the input of cpuset.sched_relax_domain_level
2008-05-13 2:27 [PATCH] cpuset: limit the input of cpuset.sched_relax_domain_level Li Zefan
@ 2008-05-13 2:29 ` Paul Menage
2008-05-13 2:42 ` Paul Jackson
2008-05-13 2:40 ` Paul Jackson
2008-05-13 3:10 ` Hidetoshi Seto
2 siblings, 1 reply; 7+ messages in thread
From: Paul Menage @ 2008-05-13 2:29 UTC (permalink / raw)
To: Li Zefan; +Cc: Andrew Morton, Paul Jackson, Hidetoshi Seto, Ingo Molnar, LKML
On Mon, May 12, 2008 at 7:27 PM, Li Zefan <lizf@cn.fujitsu.com> wrote:
> We allow the inputs to be [-1 ... SD_LV_MAX), and return -EINVAL
> for inputs outside this range.
>
> Signed-off-by: Li Zefan <lizf@cn.fujitsu.com>
Acked-by: Paul Menage <menage@google.com>
> ---
> Documentation/cpusets.txt | 2 +-
> kernel/cpuset.c | 4 ++--
> kernel/sched.c | 7 ++++++-
> 3 files changed, 9 insertions(+), 4 deletions(-)
>
> diff --git a/Documentation/cpusets.txt b/Documentation/cpusets.txt
> index fb7b361..9066ce7 100644
> --- a/Documentation/cpusets.txt
> +++ b/Documentation/cpusets.txt
> @@ -542,7 +542,7 @@ otherwise initial value -1 that indicates the cpuset has no request.
> 2 : search cores in a package.
> 3 : search cpus in a node [= system wide on non-NUMA system]
> ( 4 : search nodes in a chunk of node [on NUMA system] )
> - ( 5~ : search system wide [on NUMA system])
> + ( 5 : search system wide [on NUMA system] )
>
> This file is per-cpuset and affect the sched domain where the cpuset
> belongs to. Therefore if the flag 'sched_load_balance' of a cpuset
> diff --git a/kernel/cpuset.c b/kernel/cpuset.c
> index 86ea9e3..c192213 100644
> --- a/kernel/cpuset.c
> +++ b/kernel/cpuset.c
> @@ -1033,8 +1033,8 @@ int current_cpuset_is_being_rebound(void)
>
> static int update_relax_domain_level(struct cpuset *cs, s64 val)
> {
> - if ((int)val < 0)
> - val = -1;
> + if (val < -1 || val >= SD_LV_MAX)
> + return -EINVAL;
>
> if (val != cs->relax_domain_level) {
> cs->relax_domain_level = val;
> diff --git a/kernel/sched.c b/kernel/sched.c
> index 8841a91..24d499e 100644
> --- a/kernel/sched.c
> +++ b/kernel/sched.c
> @@ -7219,7 +7219,12 @@ static int default_relax_domain_level = -1;
>
> static int __init setup_relax_domain_level(char *str)
> {
> - default_relax_domain_level = simple_strtoul(str, NULL, 0);
> + unsigned long val;
> +
> + val = simple_strtoul(str, NULL, 0);
> + if (val < SD_LV_MAX)
> + default_relax_domain_level = val;
> +
> return 1;
> }
> __setup("relax_domain_level=", setup_relax_domain_level);
> --
> 1.5.4.rc3
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] cpuset: limit the input of cpuset.sched_relax_domain_level
2008-05-13 2:27 [PATCH] cpuset: limit the input of cpuset.sched_relax_domain_level Li Zefan
2008-05-13 2:29 ` Paul Menage
@ 2008-05-13 2:40 ` Paul Jackson
2008-05-13 2:43 ` Paul Jackson
2008-05-13 3:10 ` Hidetoshi Seto
2 siblings, 1 reply; 7+ messages in thread
From: Paul Jackson @ 2008-05-13 2:40 UTC (permalink / raw)
To: Li Zefan; +Cc: akpm, seto.hidetoshi, menage, mingo, linux-kernel
Li Zefan wrote:
> We allow the inputs to be [-1 ... SD_LV_MAX), and return -EINVAL
> for inputs outside this range.
Good. Thanks.
Signed-off-by: Paul Jackson <pj@sgi.com>
--
I won't rest till it's the best ...
Programmer, Linux Scalability
Paul Jackson <pj@sgi.com> 1.940.382.4214
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] cpuset: limit the input of cpuset.sched_relax_domain_level
2008-05-13 2:29 ` Paul Menage
@ 2008-05-13 2:42 ` Paul Jackson
0 siblings, 0 replies; 7+ messages in thread
From: Paul Jackson @ 2008-05-13 2:42 UTC (permalink / raw)
To: Paul Menage; +Cc: lizf, akpm, seto.hidetoshi, mingo, linux-kernel
On Mon, May 12, 2008 at 7:27 PM, Li Zefan <lizf@cn.fujitsu.com> wrote:
> We allow the inputs to be [-1 ... SD_LV_MAX), and return -EINVAL
> for inputs outside this range.
pj replied with a "signed-off-by"
Oops -- wrong response. Let's try:
Acked-by: Paul Jackson <pj@sgi.com>
--
I won't rest till it's the best ...
Programmer, Linux Scalability
Paul Jackson <pj@sgi.com> 1.940.382.4214
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] cpuset: limit the input of cpuset.sched_relax_domain_level
2008-05-13 2:40 ` Paul Jackson
@ 2008-05-13 2:43 ` Paul Jackson
2008-05-13 12:32 ` Ingo Molnar
0 siblings, 1 reply; 7+ messages in thread
From: Paul Jackson @ 2008-05-13 2:43 UTC (permalink / raw)
To: Paul Jackson; +Cc: lizf, akpm, seto.hidetoshi, menage, mingo, linux-kernel
> Signed-off-by: Paul Jackson <pj@sgi.com>
Wrong - make that:
Acked-by: Paul Jackson <pj@sgi.com>
--
I won't rest till it's the best ...
Programmer, Linux Scalability
Paul Jackson <pj@sgi.com> 1.940.382.4214
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] cpuset: limit the input of cpuset.sched_relax_domain_level
2008-05-13 2:27 [PATCH] cpuset: limit the input of cpuset.sched_relax_domain_level Li Zefan
2008-05-13 2:29 ` Paul Menage
2008-05-13 2:40 ` Paul Jackson
@ 2008-05-13 3:10 ` Hidetoshi Seto
2 siblings, 0 replies; 7+ messages in thread
From: Hidetoshi Seto @ 2008-05-13 3:10 UTC (permalink / raw)
To: Li Zefan; +Cc: Andrew Morton, Paul Jackson, Paul Menage, Ingo Molnar, LKML
Li Zefan wrote:
> We allow the inputs to be [-1 ... SD_LV_MAX), and return -EINVAL
> for inputs outside this range.
Looks good to me. Thanks!
H.Seto
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] cpuset: limit the input of cpuset.sched_relax_domain_level
2008-05-13 2:43 ` Paul Jackson
@ 2008-05-13 12:32 ` Ingo Molnar
0 siblings, 0 replies; 7+ messages in thread
From: Ingo Molnar @ 2008-05-13 12:32 UTC (permalink / raw)
To: Paul Jackson; +Cc: lizf, akpm, seto.hidetoshi, menage, linux-kernel
* Paul Jackson <pj@sgi.com> wrote:
> Acked-by: Paul Jackson <pj@sgi.com>
applied, thanks.
Ingo
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2008-05-13 12:32 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-05-13 2:27 [PATCH] cpuset: limit the input of cpuset.sched_relax_domain_level Li Zefan
2008-05-13 2:29 ` Paul Menage
2008-05-13 2:42 ` Paul Jackson
2008-05-13 2:40 ` Paul Jackson
2008-05-13 2:43 ` Paul Jackson
2008-05-13 12:32 ` Ingo Molnar
2008-05-13 3:10 ` Hidetoshi Seto
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox