Skip to content

Commit e197f5e

Browse files
Liang Jiehtejun
authored andcommitted
sched_ext: Use sizeof_field for key_len in dsq_hash_params
Update the `dsq_hash_params` initialization to use `sizeof_field` for the `key_len` field instead of a hardcoded value. This improves code readability and ensures the key length dynamically matches the size of the `id` field in the `scx_dispatch_q` structure. Signed-off-by: Liang Jie <liangjie@lixiang.com> Signed-off-by: Tejun Heo <tj@kernel.org>
1 parent 8da7bf2 commit e197f5e

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

kernel/sched/ext.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -960,7 +960,7 @@ static DEFINE_PER_CPU(struct task_struct *, direct_dispatch_task);
960960
static struct scx_dispatch_q **global_dsqs;
961961

962962
static const struct rhashtable_params dsq_hash_params = {
963-
.key_len = 8,
963+
.key_len = sizeof_field(struct scx_dispatch_q, id),
964964
.key_offset = offsetof(struct scx_dispatch_q, id),
965965
.head_offset = offsetof(struct scx_dispatch_q, hash_node),
966966
};

0 commit comments

Comments
 (0)