Skip to content

Commit 71b4b38

Browse files
committed
subsys: cpu_freq: remove redundant XOR calculation in k_ipi_work_add
In the current code, 'target_cpus ^= (1U << _current_cpu->id)' is first used to remove the current core. Then, k_ipi_work_add performs 'target_cpus ^ (1U << _current_cpu->id)' again when passing parameters. This will add the current core to the mask again, causing the current core to receive IPI and directly call cpu_freq_next_pstate() at the end, which may lead to duplicate execution. This commit changed 'target_cpus ^ (1U << _current_cpu->id)' to ' target_cpus' in k_ipi_work_add to avoid the second XOR. Signed-off-by: Zhaoxiang Jin <Zhaoxiang.Jin_1@nxp.com>
1 parent a0096b7 commit 71b4b38

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

subsys/cpu_freq/cpu_freq.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,7 @@ static void cpu_freq_timer_handler(struct k_timer *timer)
7272
target_cpus = (num_cpus == 32U) ? 0xFFFFFFFF : (1U << num_cpus) - 1U;
7373
target_cpus ^= (1U << _current_cpu->id),
7474

75-
ret = k_ipi_work_add(&cpu_freq_work,
76-
target_cpus ^ (1U << _current_cpu->id),
77-
cpu_freq_ipi_handler);
75+
ret = k_ipi_work_add(&cpu_freq_work, target_cpus, cpu_freq_ipi_handler);
7876

7977
if (ret != 0) {
8078
/*

0 commit comments

Comments
 (0)