[PATCH OLK-6.6 0/3] Fix RT priority Setting
Fix RT priority Setting Liu Kai (3): xsched: refactor xse_this_grp_xcu to xse_this_cfs_rq for clarity and correctness xsched: fix typo in xcu cgroup subsys released callback name xsched: initialize tgid before configuring RT priority include/linux/xsched.h | 29 ++++++++++++++--------------- kernel/xsched/cfs.c | 2 +- kernel/xsched/cgroup.c | 4 ++-- kernel/xsched/core.c | 3 +-- 4 files changed, 18 insertions(+), 20 deletions(-) -- 2.34.1
hulk inclusion category: cleanup bugzilla: https://atomgit.com/openeuler/kernel/issues/8710 ---------------------------------------- Simplify and clarify the function xse_this_grp_xcu by renaming it to xse_this_cfs_rq and adjusting its implementation to directly return the xsched_rq_cfs structure. This change ensures that only group scheduling entities can call this function, making the code more intuitive and reducing unnecessary indirection. Signed-off-by: Liu Kai <liukai284@huawei.com> --- include/linux/xsched.h | 29 ++++++++++++++--------------- kernel/xsched/cfs.c | 2 +- 2 files changed, 15 insertions(+), 16 deletions(-) diff --git a/include/linux/xsched.h b/include/linux/xsched.h index e4b08066c676..ff314f88169f 100644 --- a/include/linux/xsched.h +++ b/include/linux/xsched.h @@ -313,27 +313,26 @@ struct xsched_group { #define for_each_xsched_group(__xg) \ for (; (__xg) != root_xcg; (__xg) = (__xg)->parent) -static inline struct xsched_group_xcu_priv * -xse_this_grp_xcu(struct xsched_entity_cfs *xse_cfs) +/** + * Only group xsched entities are permitted to call. + * + * These function assumes the caller represents a scheduling group and + * accesses group-level cfs_rq structures. + */ +static inline struct xsched_rq_cfs * +xse_this_cfs_rq(struct xsched_entity *xse) { - struct xsched_entity *xse; - - xse = xse_cfs ? container_of(xse_cfs, struct xsched_entity, cfs) : NULL; - return xse ? container_of(xse, struct xsched_group_xcu_priv, xse) : NULL; -} + struct xsched_group_xcu_priv *xg_xcu = + container_of(xse, struct xsched_group_xcu_priv, xse); -static inline struct xsched_group * -xse_this_grp(struct xsched_entity_cfs *xse_cfs) -{ - return xse_cfs ? xse_this_grp_xcu(xse_cfs)->self : NULL; + return xg_xcu->cfs_rq; } static inline bool xsched_entity_throttled(struct xsched_entity *xse) { - struct xsched_group_xcu_priv *grp_xcu = - container_of(xse, struct xsched_group_xcu_priv, xse); + struct xsched_rq_cfs *cfs_rq = xse_this_cfs_rq(xse); - return grp_xcu->cfs_rq->throttled; + return cfs_rq->throttled; } #else @@ -356,7 +355,7 @@ static inline int xse_integrity_check(struct xsched_entity *xse) } #ifdef CONFIG_CGROUP_XCU - if (xse->is_group && !xse_this_grp_xcu(&xse->cfs)->cfs_rq) { + if (xse->is_group && !xse_this_cfs_rq(xse)) { // Can only be in the free process XSCHED_ERR("the sub_rq this cgroup-type xse [%d] owned cannot be NULL @ %s\n", xse->tgid, __func__); diff --git a/kernel/xsched/cfs.c b/kernel/xsched/cfs.c index 6b74f96a6860..1b2a5bcb9fbf 100644 --- a/kernel/xsched/cfs.c +++ b/kernel/xsched/cfs.c @@ -182,7 +182,7 @@ next_cfs_rq_of(struct xsched_entity_cfs *xse) struct xsched_entity *se = container_of(xse, struct xsched_entity, cfs); if (se->is_group) - return xse_this_grp_xcu(xse)->cfs_rq; + return xse_this_cfs_rq(se); #endif return NULL; } -- 2.34.1
hulk inclusion category: bugfix bugzilla: https://atomgit.com/openeuler/kernel/issues/8710 ---------------------------------------- Rename xcu_css_releasd to xcu_css_released to fix a spelling error, ensuring the correct cgroup css_released callback is properly registered. Fixes: 548dc5635411 ("xsched: restructure xcu_cgrp_subsys teardown to align with cpu_cgrp_subsys lifecycle") Signed-off-by: Liu Kai <liukai284@huawei.com> --- kernel/xsched/cgroup.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/kernel/xsched/cgroup.c b/kernel/xsched/cgroup.c index 437a1f9cf187..73f044475939 100644 --- a/kernel/xsched/cgroup.c +++ b/kernel/xsched/cgroup.c @@ -296,7 +296,7 @@ static void xcu_css_offline(struct cgroup_subsys_state *css) } } -static void xcu_css_releasd(struct cgroup_subsys_state *css) +static void xcu_css_released(struct cgroup_subsys_state *css) { struct xsched_group *xcg = xcu_cg_from_css(css); @@ -757,7 +757,7 @@ struct cgroup_subsys xcu_cgrp_subsys = { .css_alloc = xcu_css_alloc, .css_online = xcu_css_online, .css_offline = xcu_css_offline, - .css_released = xcu_css_releasd, + .css_released = xcu_css_released, .css_free = xcu_css_free, .can_attach = xcu_can_attach, .cancel_attach = xcu_cancel_attach, -- 2.34.1
hulk inclusion category: bugfix bugzilla: https://atomgit.com/openeuler/kernel/issues/8710 ---------------------------------------- Currently, the XSched attempts to configure the real-time (RT) priority for tasks without first initializing the thread group ID (tgid). This leads to failures in retrieving the correct priority configuration, as the tgid is required to look up the appropriate settings. To resolve this issue, this commit ensures that the tgid is initialized before attempting to configure the RT priority. Fixes: 3238576f2e8a ("xsched: refactor xsched_entity initialization") Signed-off-by: Liu Kai <liukai284@huawei.com> --- kernel/xsched/core.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/kernel/xsched/core.c b/kernel/xsched/core.c index b715b1401043..1d835fc44d0c 100644 --- a/kernel/xsched/core.c +++ b/kernel/xsched/core.c @@ -472,8 +472,6 @@ int init_xsched_entity(struct xsched_context *ctx, struct vstream_info *vs) if (!sched) return -ENOENT; - sched->xse_init(xse); - atomic_set(&xse->kicks_pending_cnt, 0); atomic_set(&xse->submitted_one_kick, 0); @@ -497,6 +495,7 @@ int init_xsched_entity(struct xsched_context *ctx, struct vstream_info *vs) WRITE_ONCE(xse->on_rq, false); spin_lock_init(&xse->xse_lock); + sched->xse_init(xse); return err; } -- 2.34.1
反馈: 您发送到kernel@openeuler.org的补丁/补丁集,已成功转换为PR! PR链接地址: https://atomgit.com/openeuler/kernel/merge_requests/21216 邮件列表地址:https://mailweb.openeuler.org/archives/list/kernel@openeuler.org/message/JPR... FeedBack: The patch(es) which you have sent to kernel@openeuler.org mailing list has been converted to a pull request successfully! Pull request link: https://atomgit.com/openeuler/kernel/merge_requests/21216 Mailing list address: https://mailweb.openeuler.org/archives/list/kernel@openeuler.org/message/JPR...
participants (2)
-
Liu Kai -
patchwork bot