Skip to content

Commit 08dd387

Browse files
committed
Merge tag 'sched-urgent-2020-04-19' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull scheduler fixes from Thomas Gleixner: "Two fixes for the scheduler: - Work around an uninitialized variable warning where GCC can't figure it out. - Allow 'isolcpus=' to skip unknown subparameters so that older kernels work with the commandline of a newer kernel. Improve the error output while at it" * tag 'sched-urgent-2020-04-19' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: sched/vtime: Work around an unitialized variable warning sched/isolation: Allow "isolcpus=" to skip unknown sub-parameters
2 parents 5e7de58 + e0d648f commit 08dd387

File tree

2 files changed

+21
-4
lines changed

2 files changed

+21
-4
lines changed

kernel/sched/cputime.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1003,12 +1003,12 @@ u64 kcpustat_field(struct kernel_cpustat *kcpustat,
10031003
enum cpu_usage_stat usage, int cpu)
10041004
{
10051005
u64 *cpustat = kcpustat->cpustat;
1006+
u64 val = cpustat[usage];
10061007
struct rq *rq;
1007-
u64 val;
10081008
int err;
10091009

10101010
if (!vtime_accounting_enabled_cpu(cpu))
1011-
return cpustat[usage];
1011+
return val;
10121012

10131013
rq = cpu_rq(cpu);
10141014

kernel/sched/isolation.c

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,9 @@ __setup("nohz_full=", housekeeping_nohz_full_setup);
149149
static int __init housekeeping_isolcpus_setup(char *str)
150150
{
151151
unsigned int flags = 0;
152+
bool illegal = false;
153+
char *par;
154+
int len;
152155

153156
while (isalpha(*str)) {
154157
if (!strncmp(str, "nohz,", 5)) {
@@ -169,8 +172,22 @@ static int __init housekeeping_isolcpus_setup(char *str)
169172
continue;
170173
}
171174

172-
pr_warn("isolcpus: Error, unknown flag\n");
173-
return 0;
175+
/*
176+
* Skip unknown sub-parameter and validate that it is not
177+
* containing an invalid character.
178+
*/
179+
for (par = str, len = 0; *str && *str != ','; str++, len++) {
180+
if (!isalpha(*str) && *str != '_')
181+
illegal = true;
182+
}
183+
184+
if (illegal) {
185+
pr_warn("isolcpus: Invalid flag %.*s\n", len, par);
186+
return 0;
187+
}
188+
189+
pr_info("isolcpus: Skipped unknown flag %.*s\n", len, par);
190+
str++;
174191
}
175192

176193
/* Default behaviour for isolcpus without flags */

0 commit comments

Comments
 (0)