diff options
author | Li Zefan <lizf@cn.fujitsu.com> | 2008-05-12 22:27:17 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-06-19 03:45:36 -0400 |
commit | 30e0e178193d4221abc9926b07a4c7661c7cc4a9 (patch) | |
tree | f6ad7d54e810a97345ad82b55832a2dbfb3ca6e2 | |
parent | 9bedbcb207ed9a571b239231d99c8fd4a34ae24d (diff) |
cpuset: limit the input of cpuset.sched_relax_domain_level
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>
Acked-by: Paul Jackson <pj@sgi.com>
Acked-by: Hidetoshi Seto <seto.hidetoshi@jp.fujitsu.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
-rw-r--r-- | Documentation/cpusets.txt | 2 | ||||
-rw-r--r-- | kernel/cpuset.c | 4 | ||||
-rw-r--r-- | kernel/sched.c | 7 |
3 files changed, 9 insertions, 4 deletions
diff --git a/Documentation/cpusets.txt b/Documentation/cpusets.txt index d803c5c68ab5..353504de3084 100644 --- a/Documentation/cpusets.txt +++ b/Documentation/cpusets.txt | |||
@@ -542,7 +542,7 @@ otherwise initial value -1 that indicates the cpuset has no request. | |||
542 | 2 : search cores in a package. | 542 | 2 : search cores in a package. |
543 | 3 : search cpus in a node [= system wide on non-NUMA system] | 543 | 3 : search cpus in a node [= system wide on non-NUMA system] |
544 | ( 4 : search nodes in a chunk of node [on NUMA system] ) | 544 | ( 4 : search nodes in a chunk of node [on NUMA system] ) |
545 | ( 5~ : search system wide [on NUMA system]) | 545 | ( 5 : search system wide [on NUMA system] ) |
546 | 546 | ||
547 | This file is per-cpuset and affect the sched domain where the cpuset | 547 | This file is per-cpuset and affect the sched domain where the cpuset |
548 | belongs to. Therefore if the flag 'sched_load_balance' of a cpuset | 548 | belongs to. Therefore if the flag 'sched_load_balance' of a cpuset |
diff --git a/kernel/cpuset.c b/kernel/cpuset.c index 039baa4cd90c..66103a119bfe 100644 --- a/kernel/cpuset.c +++ b/kernel/cpuset.c | |||
@@ -1037,8 +1037,8 @@ int current_cpuset_is_being_rebound(void) | |||
1037 | 1037 | ||
1038 | static int update_relax_domain_level(struct cpuset *cs, s64 val) | 1038 | static int update_relax_domain_level(struct cpuset *cs, s64 val) |
1039 | { | 1039 | { |
1040 | if ((int)val < 0) | 1040 | if (val < -1 || val >= SD_LV_MAX) |
1041 | val = -1; | 1041 | return -EINVAL; |
1042 | 1042 | ||
1043 | if (val != cs->relax_domain_level) { | 1043 | if (val != cs->relax_domain_level) { |
1044 | cs->relax_domain_level = val; | 1044 | cs->relax_domain_level = val; |
diff --git a/kernel/sched.c b/kernel/sched.c index eaf6751e7612..bb2c699c9f5e 100644 --- a/kernel/sched.c +++ b/kernel/sched.c | |||
@@ -6877,7 +6877,12 @@ static int default_relax_domain_level = -1; | |||
6877 | 6877 | ||
6878 | static int __init setup_relax_domain_level(char *str) | 6878 | static int __init setup_relax_domain_level(char *str) |
6879 | { | 6879 | { |
6880 | default_relax_domain_level = simple_strtoul(str, NULL, 0); | 6880 | unsigned long val; |
6881 | |||
6882 | val = simple_strtoul(str, NULL, 0); | ||
6883 | if (val < SD_LV_MAX) | ||
6884 | default_relax_domain_level = val; | ||
6885 | |||
6881 | return 1; | 6886 | return 1; |
6882 | } | 6887 | } |
6883 | __setup("relax_domain_level=", setup_relax_domain_level); | 6888 | __setup("relax_domain_level=", setup_relax_domain_level); |