[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20241213095254.1577635-1-buaajxlj@163.com>
Date: Fri, 13 Dec 2024 17:52:54 +0800
From: Liang Jie <buaajxlj@....com>
To: tj@...nel.org
Cc: void@...ifault.com,
mingo@...hat.com,
peterz@...radead.org,
juri.lelli@...hat.com,
vincent.guittot@...aro.org,
dietmar.eggemann@....com,
rostedt@...dmis.org,
bsegall@...gle.com,
mgorman@...e.de,
vschneid@...hat.com,
linux-kernel@...r.kernel.org,
fanggeng@...iang.com,
yangchen11@...iang.com,
Liang Jie <liangjie@...iang.com>
Subject: [PATCH] sched_ext: Use sizeof_field for key_len in dsq_hash_params
From: Liang Jie <liangjie@...iang.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@...iang.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
Powered by blists - more mailing lists