* [PATCH v2 0/2] sched/rt: Move sched_rt_entity::back to CONFIG_RT_GROUP_SCHED
@ 2024-06-05 13:35 Yajun Deng
2024-06-05 13:35 ` [PATCH v2 1/2] sched/rt: Use 'back' only if CONFIG_RT_GROUP_SCHED is enabled Yajun Deng
2024-06-05 13:35 ` [PATCH v2 2/2] sched/headers: Move sched_rt_entity::back to under the CONFIG_RT_GROUP_SCHED block Yajun Deng
0 siblings, 2 replies; 3+ messages in thread
From: Yajun Deng @ 2024-06-05 13:35 UTC (permalink / raw)
To: mingo, peterz, juri.lelli, vincent.guittot, dietmar.eggemann,
rostedt, bsegall, mgorman, bristot, vschneid
Cc: linux-kernel, Yajun Deng
The 'back' member in struct sched_rt_entity only related to RT_GROUP_SCHED,
it should not place out of RT_GROUP_SCHED, move 'back' to RT_GROUP_SCHED.
It will save a few bytes.
v1 -> v2:
- introduce rt_se_back() helper function.
Yajun Deng (2):
sched/rt: Use 'back' only if CONFIG_RT_GROUP_SCHED is enabled
sched/headers: Move sched_rt_entity::back to under the
CONFIG_RT_GROUP_SCHED block
include/linux/sched.h | 2 +-
kernel/sched/rt.c | 22 ++++++++++++++++------
2 files changed, 17 insertions(+), 7 deletions(-)
--
2.25.1
^ permalink raw reply [flat|nested] 3+ messages in thread* [PATCH v2 1/2] sched/rt: Use 'back' only if CONFIG_RT_GROUP_SCHED is enabled
2024-06-05 13:35 [PATCH v2 0/2] sched/rt: Move sched_rt_entity::back to CONFIG_RT_GROUP_SCHED Yajun Deng
@ 2024-06-05 13:35 ` Yajun Deng
2024-06-05 13:35 ` [PATCH v2 2/2] sched/headers: Move sched_rt_entity::back to under the CONFIG_RT_GROUP_SCHED block Yajun Deng
1 sibling, 0 replies; 3+ messages in thread
From: Yajun Deng @ 2024-06-05 13:35 UTC (permalink / raw)
To: mingo, peterz, juri.lelli, vincent.guittot, dietmar.eggemann,
rostedt, bsegall, mgorman, bristot, vschneid
Cc: linux-kernel, Yajun Deng
The 'back' member in struct sched_rt_entity only related to
CONFIG_RT_GROUP_SCHED, so there is no need to init it in dequeue_rt_stack.
Init the 'back' member in init_tg_rt_entry and use it only if
CONFIG_RT_GROUP_SCHED is enabled.
Signed-off-by: Yajun Deng <yajun.deng@linux.dev>
---
kernel/sched/rt.c | 22 ++++++++++++++++------
1 file changed, 16 insertions(+), 6 deletions(-)
diff --git a/kernel/sched/rt.c b/kernel/sched/rt.c
index 63e49c8ffc4d..842a2cfd6dcc 100644
--- a/kernel/sched/rt.c
+++ b/kernel/sched/rt.c
@@ -230,10 +230,12 @@ void init_tg_rt_entry(struct task_group *tg, struct rt_rq *rt_rq,
if (!rt_se)
return;
- if (!parent)
+ if (!parent) {
rt_se->rt_rq = &rq->rt;
- else
+ } else {
rt_se->rt_rq = parent->my_q;
+ parent->back = rt_se;
+ }
rt_se->my_q = rt_rq;
rt_se->parent = parent;
@@ -604,6 +606,11 @@ static inline struct rt_bandwidth *sched_rt_bandwidth(struct rt_rq *rt_rq)
return &rt_rq->tg->rt_bandwidth;
}
+static struct sched_rt_entity *rt_se_back(struct sched_rt_entity *se)
+{
+ return se->back;
+}
+
#else /* !CONFIG_RT_GROUP_SCHED */
static inline u64 sched_rt_runtime(struct rt_rq *rt_rq)
@@ -666,6 +673,11 @@ static inline struct rt_bandwidth *sched_rt_bandwidth(struct rt_rq *rt_rq)
return &def_rt_bandwidth;
}
+static inline struct sched_rt_entity *rt_se_back(struct sched_rt_entity *se)
+{
+ return NULL;
+}
+
#endif /* CONFIG_RT_GROUP_SCHED */
bool sched_rt_bandwidth_account(struct rt_rq *rt_rq)
@@ -1428,14 +1440,12 @@ static void dequeue_rt_stack(struct sched_rt_entity *rt_se, unsigned int flags)
struct sched_rt_entity *back = NULL;
unsigned int rt_nr_running;
- for_each_sched_rt_entity(rt_se) {
- rt_se->back = back;
+ for_each_sched_rt_entity(rt_se)
back = rt_se;
- }
rt_nr_running = rt_rq_of_se(back)->rt_nr_running;
- for (rt_se = back; rt_se; rt_se = rt_se->back) {
+ for (rt_se = back; rt_se; rt_se = rt_se_back(rt_se)) {
if (on_rt_rq(rt_se))
__dequeue_rt_entity(rt_se, flags);
}
--
2.25.1
^ permalink raw reply related [flat|nested] 3+ messages in thread* [PATCH v2 2/2] sched/headers: Move sched_rt_entity::back to under the CONFIG_RT_GROUP_SCHED block
2024-06-05 13:35 [PATCH v2 0/2] sched/rt: Move sched_rt_entity::back to CONFIG_RT_GROUP_SCHED Yajun Deng
2024-06-05 13:35 ` [PATCH v2 1/2] sched/rt: Use 'back' only if CONFIG_RT_GROUP_SCHED is enabled Yajun Deng
@ 2024-06-05 13:35 ` Yajun Deng
1 sibling, 0 replies; 3+ messages in thread
From: Yajun Deng @ 2024-06-05 13:35 UTC (permalink / raw)
To: mingo, peterz, juri.lelli, vincent.guittot, dietmar.eggemann,
rostedt, bsegall, mgorman, bristot, vschneid
Cc: linux-kernel, Yajun Deng
We already remove the call to the 'back' member when CONFIG_RT_GROUP_SCHED
is disabled.
It's safe to move sched_rt_entity::back to under the
CONFIG_RT_GROUP_SCHED block, it would save a few bytes.
Signed-off-by: Yajun Deng <yajun.deng@linux.dev>
---
include/linux/sched.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/linux/sched.h b/include/linux/sched.h
index f2f907ef1389..79d3bdda9463 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -582,8 +582,8 @@ struct sched_rt_entity {
unsigned short on_rq;
unsigned short on_list;
- struct sched_rt_entity *back;
#ifdef CONFIG_RT_GROUP_SCHED
+ struct sched_rt_entity *back;
struct sched_rt_entity *parent;
/* rq on which this entity is (to be) queued: */
struct rt_rq *rt_rq;
--
2.25.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-06-05 13:36 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-06-05 13:35 [PATCH v2 0/2] sched/rt: Move sched_rt_entity::back to CONFIG_RT_GROUP_SCHED Yajun Deng
2024-06-05 13:35 ` [PATCH v2 1/2] sched/rt: Use 'back' only if CONFIG_RT_GROUP_SCHED is enabled Yajun Deng
2024-06-05 13:35 ` [PATCH v2 2/2] sched/headers: Move sched_rt_entity::back to under the CONFIG_RT_GROUP_SCHED block Yajun Deng
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.