Skip to content

Commit adc353c

Browse files
arndbrostedt
authored andcommitted
kernel: trace: preemptirq_delay_test: use offstack cpu mask
A CPU mask on the stack is broken for large values of CONFIG_NR_CPUS: kernel/trace/preemptirq_delay_test.c: In function ‘preemptirq_delay_run’: kernel/trace/preemptirq_delay_test.c:143:1: error: the frame size of 8512 bytes is larger than 1536 bytes [-Werror=frame-larger-than=] Fall back to dynamic allocation here. Cc: Masami Hiramatsu <[email protected]> Cc: Song Chen <[email protected]> Cc: Mathieu Desnoyers <[email protected]> Link: https://lore.kernel.org/[email protected] Fixes: 4b9091e ("kernel: trace: preemptirq_delay_test: add cpu affinity") Signed-off-by: Arnd Bergmann <[email protected]> Signed-off-by: Steven Rostedt (Google) <[email protected]>
1 parent 3aceaa5 commit adc353c

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

kernel/trace/preemptirq_delay_test.c

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -117,12 +117,15 @@ static int preemptirq_delay_run(void *data)
117117
{
118118
int i;
119119
int s = MIN(burst_size, NR_TEST_FUNCS);
120-
struct cpumask cpu_mask;
120+
cpumask_var_t cpu_mask;
121+
122+
if (!alloc_cpumask_var(&cpu_mask, GFP_KERNEL))
123+
return -ENOMEM;
121124

122125
if (cpu_affinity > -1) {
123-
cpumask_clear(&cpu_mask);
124-
cpumask_set_cpu(cpu_affinity, &cpu_mask);
125-
if (set_cpus_allowed_ptr(current, &cpu_mask))
126+
cpumask_clear(cpu_mask);
127+
cpumask_set_cpu(cpu_affinity, cpu_mask);
128+
if (set_cpus_allowed_ptr(current, cpu_mask))
126129
pr_err("cpu_affinity:%d, failed\n", cpu_affinity);
127130
}
128131

@@ -139,6 +142,8 @@ static int preemptirq_delay_run(void *data)
139142

140143
__set_current_state(TASK_RUNNING);
141144

145+
free_cpumask_var(cpu_mask);
146+
142147
return 0;
143148
}
144149

0 commit comments

Comments
 (0)