提交 30e0e178 编写于 作者: L Li Zefan 提交者: Ingo Molnar

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: NLi Zefan <lizf@cn.fujitsu.com>
Acked-by: NPaul Menage <menage@google.com>
Acked-by: NPaul Jackson <pj@sgi.com>
Acked-by: NHidetoshi Seto <seto.hidetoshi@jp.fujitsu.com>
Signed-off-by: NIngo Molnar <mingo@elte.hu>
Signed-off-by: NThomas Gleixner <tglx@linutronix.de>
上级 9bedbcb2
...@@ -542,7 +542,7 @@ otherwise initial value -1 that indicates the cpuset has no request. ...@@ -542,7 +542,7 @@ otherwise initial value -1 that indicates the cpuset has no request.
2 : search cores in a package. 2 : search cores in a package.
3 : search cpus in a node [= system wide on non-NUMA system] 3 : search cpus in a node [= system wide on non-NUMA system]
( 4 : search nodes in a chunk of node [on 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 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 belongs to. Therefore if the flag 'sched_load_balance' of a cpuset
......
...@@ -1037,8 +1037,8 @@ int current_cpuset_is_being_rebound(void) ...@@ -1037,8 +1037,8 @@ int current_cpuset_is_being_rebound(void)
static int update_relax_domain_level(struct cpuset *cs, s64 val) static int update_relax_domain_level(struct cpuset *cs, s64 val)
{ {
if ((int)val < 0) if (val < -1 || val >= SD_LV_MAX)
val = -1; return -EINVAL;
if (val != cs->relax_domain_level) { if (val != cs->relax_domain_level) {
cs->relax_domain_level = val; cs->relax_domain_level = val;
......
...@@ -6877,7 +6877,12 @@ static int default_relax_domain_level = -1; ...@@ -6877,7 +6877,12 @@ static int default_relax_domain_level = -1;
static int __init setup_relax_domain_level(char *str) 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; return 1;
} }
__setup("relax_domain_level=", setup_relax_domain_level); __setup("relax_domain_level=", setup_relax_domain_level);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册