summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorDavid Carlier <devnexen@gmail.com>2026-02-24 08:56:37 +0300
committerTejun Heo <tj@kernel.org>2026-02-24 20:59:24 +0300
commit477174ac35c510d0ed3043f5bd4fba25546a21ce (patch)
tree60a2bc064e6e7129b8e2a5aa6e0c726f2a377e3e /include
parent658ad2259b3e95aea21e548f7ca3440f620bf95f (diff)
downloadlinux-477174ac35c510d0ed3043f5bd4fba25546a21ce.tar.xz
sched_ext: Optimize sched_ext_entity layout for cache locality
Reorder struct sched_ext_entity to place ops_state, ddsp_dsq_id, and ddsp_enq_flags immediately after dsq. These fields are accessed together in the do_enqueue_task() and finish_dispatch() hot paths but were previously spread across three different cache lines. Grouping them on the same cache line reduces cache misses on every enqueue and dispatch operation. Signed-off-by: David Carlier <devnexen@gmail.com> Signed-off-by: Tejun Heo <tj@kernel.org>
Diffstat (limited to 'include')
-rw-r--r--include/linux/sched/ext.h6
1 files changed, 3 insertions, 3 deletions
diff --git a/include/linux/sched/ext.h b/include/linux/sched/ext.h
index 4601e5ecb43c..0150b3fe6230 100644
--- a/include/linux/sched/ext.h
+++ b/include/linux/sched/ext.h
@@ -163,6 +163,9 @@ struct scx_dsq_list_node {
*/
struct sched_ext_entity {
struct scx_dispatch_q *dsq;
+ atomic_long_t ops_state;
+ u64 ddsp_dsq_id;
+ u64 ddsp_enq_flags;
struct scx_dsq_list_node dsq_list; /* dispatch order */
struct rb_node dsq_priq; /* p->scx.dsq_vtime order */
u32 dsq_seq;
@@ -174,7 +177,6 @@ struct sched_ext_entity {
s32 selected_cpu;
u32 kf_mask; /* see scx_kf_mask above */
struct task_struct *kf_tasks[2]; /* see SCX_CALL_OP_TASK() */
- atomic_long_t ops_state;
struct list_head runnable_node; /* rq->scx.runnable_list */
unsigned long runnable_at;
@@ -182,8 +184,6 @@ struct sched_ext_entity {
#ifdef CONFIG_SCHED_CORE
u64 core_sched_at; /* see scx_prio_less() */
#endif
- u64 ddsp_dsq_id;
- u64 ddsp_enq_flags;
/* BPF scheduler modifiable fields */