The Linux Kernel Mailing List
 help / color / mirror / Atom feed
* Re: [PATCH v2] sched/ext: Add tg->scx.idle which tracks the current state
       [not found] <aOVmuWwyLUNkPG7S@slm.duckdns.org>
@ 2025-10-08  2:22 ` zhidao su
  2025-10-08  2:22 ` [PATCH] " zhidao su
  1 sibling, 0 replies; 2+ messages in thread
From: zhidao su @ 2025-10-08  2:22 UTC (permalink / raw)
  To: suzhidao; +Cc: linux-kernel

v2: Add tg->scx.idle which tracks the current state

^ permalink raw reply	[flat|nested] 2+ messages in thread

* [PATCH] sched/ext: Add tg->scx.idle which tracks the current state
       [not found] <aOVmuWwyLUNkPG7S@slm.duckdns.org>
  2025-10-08  2:22 ` [PATCH v2] sched/ext: Add tg->scx.idle which tracks the current state zhidao su
@ 2025-10-08  2:22 ` zhidao su
  1 sibling, 0 replies; 2+ messages in thread
From: zhidao su @ 2025-10-08  2:22 UTC (permalink / raw)
  To: suzhidao; +Cc: linux-kernel, zhidao su

Add an idle field to the scx_task_group structure to track the current
idle state of a task group. This field is initialized to false in
scx_tg_init() and updated in scx_group_set_idle() when the idle state
changes.

This allows BPF schedulers to check the current idle state of a task
group directly from the scx_task_group structure.

v2: Add tg->scx.idle which tracks the current state
Signed-off-by: zhidao su <soolaugust@gmail.com>
---
 include/linux/sched/ext.h | 1 +
 kernel/sched/ext.c        | 4 ++++
 2 files changed, 5 insertions(+)

diff --git a/include/linux/sched/ext.h b/include/linux/sched/ext.h
index 7047101dbf58..b65e9abafcb6 100644
--- a/include/linux/sched/ext.h
+++ b/include/linux/sched/ext.h
@@ -224,6 +224,7 @@ struct scx_task_group {
 	u64			bw_period_us;
 	u64			bw_quota_us;
 	u64			bw_burst_us;
+	bool			idle;
 #endif
 };
 
diff --git a/kernel/sched/ext.c b/kernel/sched/ext.c
index 72bf2ad382fb..a2bbcc34e5d5 100644
--- a/kernel/sched/ext.c
+++ b/kernel/sched/ext.c
@@ -4103,6 +4103,7 @@ void scx_tg_init(struct task_group *tg)
 	tg->scx.weight = CGROUP_WEIGHT_DFL;
 	tg->scx.bw_period_us = default_bw_period_us();
 	tg->scx.bw_quota_us = RUNTIME_INF;
+	tg->scx.idle = false;
 }
 
 int scx_tg_online(struct task_group *tg)
@@ -4273,6 +4274,9 @@ void scx_group_set_idle(struct task_group *tg, bool idle)
 
 	percpu_down_read(&scx_cgroup_rwsem);
 
+	/* Update the task group's idle state */
+	tg->scx.idle = idle;
+
 	if (scx_cgroup_enabled && SCX_HAS_OP(sch, cgroup_set_idle))
 		SCX_CALL_OP(sch, SCX_KF_UNLOCKED, cgroup_set_idle, NULL,
 			    tg_cgrp(tg), idle);
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-10-08  2:23 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <aOVmuWwyLUNkPG7S@slm.duckdns.org>
2025-10-08  2:22 ` [PATCH v2] sched/ext: Add tg->scx.idle which tracks the current state zhidao su
2025-10-08  2:22 ` [PATCH] " zhidao su

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox