Skip to content

Commit 3aa6715

Browse files
committed
Merge: workqueue: Avoid using isolated cpus' timers on queue_delayed_work
MR: https://gitlab.com/redhat/centos-stream/src/kernel/centos-stream-9/-/merge_requests/3781 JIRA: https://issues.redhat.com/browse/RHEL-20254 Tested: oslat test on host & guest VM Upstream Status: https://git.kernel.org/pub/scm/linux/kernel/git/tj/wq.git/ Improves latency for host & guest RT tasks running on isolated CPUs. - Avoid usage of isolated CPU to handle timer interrupts on schedule_delayed_work(). Signed-off-by: Leonardo Bras <leobras@redhat.com> Approved-by: Waiman Long <longman@redhat.com> Approved-by: Marcelo Tosatti <mtosatti@redhat.com> Merged-by: Lucas Zampieri <lzampier@redhat.com>
2 parents 178dfd2 + 6f7f4ba commit 3aa6715

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

kernel/workqueue.c

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1677,10 +1677,18 @@ static void __queue_delayed_work(int cpu, struct workqueue_struct *wq,
16771677
dwork->cpu = cpu;
16781678
timer->expires = jiffies + delay;
16791679

1680-
if (unlikely(cpu != WORK_CPU_UNBOUND))
1680+
if (housekeeping_enabled(HK_TYPE_TIMER)) {
1681+
/* If the current cpu is a housekeeping cpu, use it. */
1682+
cpu = smp_processor_id();
1683+
if (!housekeeping_test_cpu(cpu, HK_TYPE_TIMER))
1684+
cpu = housekeeping_any_cpu(HK_TYPE_TIMER);
16811685
add_timer_on(timer, cpu);
1682-
else
1683-
add_timer(timer);
1686+
} else {
1687+
if (likely(cpu == WORK_CPU_UNBOUND))
1688+
add_timer(timer);
1689+
else
1690+
add_timer_on(timer, cpu);
1691+
}
16841692
}
16851693

16861694
/**

0 commit comments

Comments
 (0)