Skip to content

Commit

Permalink
cpuset: limit the input of cpuset.sched_relax_domain_level
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Li Zefan authored and Ingo Molnar committed Jun 19, 2008
1 parent 9bedbcb commit 30e0e17
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Documentation/cpusets.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions kernel/cpuset.c
Original file line number Diff line number Diff line change
Expand Up @@ -1037,8 +1037,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;
Expand Down
7 changes: 6 additions & 1 deletion kernel/sched.c
Original file line number Diff line number Diff line change
Expand Up @@ -6877,7 +6877,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);
Expand Down

0 comments on commit 30e0e17

Please sign in to comment.