Skip to content

Commit a6e4491

Browse files
praritIngo Molnar
authored andcommitted
sched/isolcpus: Output warning when the 'isolcpus=' kernel parameter is invalid
The isolcpus= kernel boot parameter restricts userspace from scheduling on the specified CPUs. If a CPU is specified that is outside the range of 0 to nr_cpu_ids, cpulist_parse() will return -ERANGE, return an empty cpulist, and fail silently. This patch adds an error message to isolated_cpu_setup() to indicate to the user that something has gone awry, and returns 0 on error. Signed-off-by: Prarit Bhargava <[email protected]> Cc: Linus Torvalds <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Thomas Gleixner <[email protected]> Link: http://lkml.kernel.org/r/[email protected] [ Twiddled some details. ] Signed-off-by: Ingo Molnar <[email protected]>
1 parent b37a05c commit a6e4491

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

kernel/sched/core.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6173,11 +6173,16 @@ cpu_attach_domain(struct sched_domain *sd, struct root_domain *rd, int cpu)
61736173
/* Setup the mask of cpus configured for isolated domains */
61746174
static int __init isolated_cpu_setup(char *str)
61756175
{
6176+
int ret;
6177+
61766178
alloc_bootmem_cpumask_var(&cpu_isolated_map);
6177-
cpulist_parse(str, cpu_isolated_map);
6179+
ret = cpulist_parse(str, cpu_isolated_map);
6180+
if (ret) {
6181+
pr_err("sched: Error, all isolcpus= values must be between 0 and %d\n", nr_cpu_ids);
6182+
return 0;
6183+
}
61786184
return 1;
61796185
}
6180-
61816186
__setup("isolcpus=", isolated_cpu_setup);
61826187

61836188
struct s_data {

0 commit comments

Comments
 (0)