hulk inclusion category: cleanup bugzilla: https://atomgit.com/openeuler/kernel/issues/8423 -------------------------------- To align with the unified scheduling entity model and improve layering clarity, this commit updates the signature of rq_init() to accept a struct xsched_rq * instead of struct xsched_cu *. The xsched_rq structure now serves as the canonical runqueue representation across both CFS and RT scheduling classes, while xsched_cu is being phased out as a top-level interface for runqueue initialization. It will simplify future support for mixed-class cgroups by decoupling runqueue setup from CU-specific abstractions. Signed-off-by: Liu Kai <liukai284@huawei.com> --- include/linux/xsched.h | 3 +-- kernel/xsched/cfs.c | 10 +++++++--- kernel/xsched/core.c | 2 +- kernel/xsched/rt.c | 9 ++++++--- 4 files changed, 15 insertions(+), 9 deletions(-) diff --git a/include/linux/xsched.h b/include/linux/xsched.h index ade26d148809..08f0c0a74555 100644 --- a/include/linux/xsched.h +++ b/include/linux/xsched.h @@ -96,7 +96,6 @@ struct xsched_rq_cfs { */ struct xsched_rq { struct xsched_entity *curr_xse; - const struct xsched_class *class; int state; int nr_running; @@ -418,7 +417,7 @@ struct xsched_class { void (*xse_deinit)(struct xsched_entity *xse); /* Initialize a new runqueue per xcu */ - void (*rq_init)(struct xsched_cu *xcu); + void (*rq_init)(struct xsched_rq *xrq); /* Removes a given XSE from it's runqueue. */ void (*dequeue_ctx)(struct xsched_entity *xse); diff --git a/kernel/xsched/cfs.c b/kernel/xsched/cfs.c index 635e90b9afa1..14397d0e48f4 100644 --- a/kernel/xsched/cfs.c +++ b/kernel/xsched/cfs.c @@ -228,10 +228,14 @@ static void put_prev_ctx_fair(struct xsched_entity *xse) #endif } -void rq_init_fair(struct xsched_cu *xcu) +void rq_init_fair(struct xsched_rq *xrq) { - xcu->xrq.cfs.ctx_timeline = RB_ROOT_CACHED; - xcu->xrq.cfs.min_xruntime = XSCHED_TIME_INF; + if (!xrq) + return; + + xrq->cfs.nr_running = 0; + xrq->cfs.ctx_timeline = RB_ROOT_CACHED; + xrq->cfs.min_xruntime = XSCHED_TIME_INF; } void xse_init_fair(struct xsched_entity *xse) diff --git a/kernel/xsched/core.c b/kernel/xsched/core.c index e9b0c6c4c86c..631920ae11d3 100644 --- a/kernel/xsched/core.c +++ b/kernel/xsched/core.c @@ -445,7 +445,7 @@ int xsched_xcu_init(struct xsched_cu *xcu, struct xcu_group *group, int xcu_id) /* Initialize current XCU's runqueue. */ for_each_xsched_class(sched) - sched->rq_init(xcu); + sched->rq_init(&xcu->xrq); /* This worker should set XCU to XSCHED_XCU_WAIT_IDLE. * If after initialization XCU still has XSCHED_XCU_NONE diff --git a/kernel/xsched/rt.c b/kernel/xsched/rt.c index 0de63deef54e..f62500634347 100644 --- a/kernel/xsched/rt.c +++ b/kernel/xsched/rt.c @@ -111,14 +111,17 @@ static bool check_preempt_ctx_rt(struct xsched_entity *xse) return true; } -void rq_init_rt(struct xsched_cu *xcu) +void rq_init_rt(struct xsched_rq *xrq) { int prio = 0; - xcu->xrq.rt.nr_running = 0; + if (!xrq) + return; + + xrq->rt.nr_running = 0; for_each_xse_prio(prio) { - INIT_LIST_HEAD(&xcu->xrq.rt.rq[prio]); + INIT_LIST_HEAD(&xrq->rt.rq[prio]); } } -- 2.34.1