summaryrefslogtreecommitdiff
path: root/include/linux/sched
diff options
context:
space:
mode:
authorTejun Heo <tj@kernel.org>2024-09-10 02:42:47 +0300
committerTejun Heo <tj@kernel.org>2024-09-10 02:42:47 +0300
commit6462dd53a26088a433f90a5c15822196f201037c (patch)
treef949be4a507b23f6dce42b522d05666823262e2e /include/linux/sched
parentcf3e94430dd994114e48f0b488f22e68e14b5976 (diff)
downloadlinux-6462dd53a26088a433f90a5c15822196f201037c.tar.xz
sched_ext: Compact struct bpf_iter_scx_dsq_kern
struct scx_iter_scx_dsq is defined as 6 u64's and scx_dsq_iter_kern was using 5 of them. We want to add two more u64 fields but it's better if we do so while staying within scx_iter_scx_dsq to maintain binary compatibility. The way scx_iter_scx_dsq_kern is laid out is rather inefficient - the node field takes up three u64's but only one bit of the last u64 is used. Turn the bool into u32 flags and only use the lower 16 bits freeing up 48 bits - 16 bits for flags, 32 bits for a u32 - for use by struct bpf_iter_scx_dsq_kern. This allows moving the dsq_seq and flags fields of bpf_iter_scx_dsq_kern into the cursor field reducing the struct size by a full u64. No behavior changes intended. Signed-off-by: Tejun Heo <tj@kernel.org>
Diffstat (limited to 'include/linux/sched')
-rw-r--r--include/linux/sched/ext.h10
1 files changed, 9 insertions, 1 deletions
diff --git a/include/linux/sched/ext.h b/include/linux/sched/ext.h
index dc646cca4fcf..1ddbde64a31b 100644
--- a/include/linux/sched/ext.h
+++ b/include/linux/sched/ext.h
@@ -119,9 +119,17 @@ enum scx_kf_mask {
__SCX_KF_TERMINAL = SCX_KF_ENQUEUE | SCX_KF_SELECT_CPU | SCX_KF_REST,
};
+enum scx_dsq_lnode_flags {
+ SCX_DSQ_LNODE_ITER_CURSOR = 1 << 0,
+
+ /* high 16 bits can be for iter cursor flags */
+ __SCX_DSQ_LNODE_PRIV_SHIFT = 16,
+};
+
struct scx_dsq_list_node {
struct list_head node;
- bool is_bpf_iter_cursor;
+ u32 flags;
+ u32 priv; /* can be used by iter cursor */
};
/*