Skip to content

Commit c86a89b

Browse files
authored
Merge pull request #3025 from hodgesds/p2dq-interactive-sticky-icky
scx_p2dq: Make interactive sticky dispatch to per CPU DSQs
2 parents f72a9e3 + 23c5c53 commit c86a89b

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

scheds/rust/scx_p2dq/src/bpf/main.bpf.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1008,9 +1008,11 @@ static void async_p2dq_enqueue(struct enqueue_promise *ret,
10081008

10091009
// Handle affinitized tasks: always use per-CPU affn_dsq
10101010
// All affinitized tasks queued to affn_dsq regardless of affinity breadth
1011+
// Also handle interactive tasks when interactive_sticky is enabled
10111012
if (!task_ctx_test_flag(taskc, TASK_CTX_F_ALL_CPUS) ||
10121013
(p->cpus_ptr == &p->cpus_mask &&
1013-
p->nr_cpus_allowed != topo_config.nr_cpus)) {
1014+
p->nr_cpus_allowed != topo_config.nr_cpus) ||
1015+
(p2dq_config.interactive_sticky && task_ctx_test_flag(taskc, TASK_CTX_F_INTERACTIVE))) {
10141016
bool has_cleared_idle = false;
10151017
if (!__COMPAT_is_enq_cpu_selected(enq_flags) ||
10161018
!bpf_cpumask_test_cpu(cpu, p->cpus_ptr))
@@ -1033,7 +1035,11 @@ static void async_p2dq_enqueue(struct enqueue_promise *ret,
10331035
return;
10341036
}
10351037

1036-
stat_inc(P2DQ_STAT_ENQ_CPU);
1038+
// Track whether this is an interactive sticky enqueue or regular affinity enqueue
1039+
if (p2dq_config.interactive_sticky && task_ctx_test_flag(taskc, TASK_CTX_F_INTERACTIVE))
1040+
stat_inc(P2DQ_STAT_ENQ_INTR);
1041+
else
1042+
stat_inc(P2DQ_STAT_ENQ_CPU);
10371043

10381044
// Select target CPU for affn_dsq with priority:
10391045
// 1. prev_cpu if in affinity

0 commit comments

Comments
 (0)