* [PATCH] sched_ext: Use sizeof_field for key_len in dsq_hash_params
@ 2024-12-13 9:52 Liang Jie
2024-12-13 16:51 ` Tejun Heo
0 siblings, 1 reply; 2+ messages in thread
From: Liang Jie @ 2024-12-13 9:52 UTC (permalink / raw)
To: tj
Cc: void, mingo, peterz, juri.lelli, vincent.guittot,
dietmar.eggemann, rostedt, bsegall, mgorman, vschneid,
linux-kernel, fanggeng, yangchen11, Liang Jie
From: Liang Jie <liangjie@lixiang.com>
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>
---
kernel/sched/ext.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/kernel/sched/ext.c b/kernel/sched/ext.c
index 7fff1d045477..4bd964fc7bbb 100644
--- a/kernel/sched/ext.c
+++ b/kernel/sched/ext.c
@@ -960,7 +960,7 @@ static DEFINE_PER_CPU(struct task_struct *, direct_dispatch_task);
static struct scx_dispatch_q **global_dsqs;
static const struct rhashtable_params dsq_hash_params = {
- .key_len = 8,
+ .key_len = sizeof_field(struct scx_dispatch_q, id),
.key_offset = offsetof(struct scx_dispatch_q, id),
.head_offset = offsetof(struct scx_dispatch_q, hash_node),
};
--
2.25.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] sched_ext: Use sizeof_field for key_len in dsq_hash_params
2024-12-13 9:52 [PATCH] sched_ext: Use sizeof_field for key_len in dsq_hash_params Liang Jie
@ 2024-12-13 16:51 ` Tejun Heo
0 siblings, 0 replies; 2+ messages in thread
From: Tejun Heo @ 2024-12-13 16:51 UTC (permalink / raw)
To: Liang Jie
Cc: void, mingo, peterz, juri.lelli, vincent.guittot,
dietmar.eggemann, rostedt, bsegall, mgorman, vschneid,
linux-kernel, fanggeng, yangchen11, Liang Jie
On Fri, Dec 13, 2024 at 05:52:54PM +0800, Liang Jie wrote:
> From: Liang Jie <liangjie@lixiang.com>
>
> 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>
Applied to sched_ext/for-6.14.
Thanks.
--
tejun
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-12-13 16:51 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-12-13 9:52 [PATCH] sched_ext: Use sizeof_field for key_len in dsq_hash_params Liang Jie
2024-12-13 16:51 ` Tejun Heo
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).