[PATCH OLK-6.6 0/3] fs/resctrl: Restore default settings for all resctrl_res_level

Zeng Heng (3): fs/resctrl: Free mbm_total and mbm_local when fails fs/resctrl: Restore default settings for all resctrl_res_level fs/resctrl: Add missing rdt_last_cmd_clear() after rdtgroup_kn_lock_live() fs/resctrl/rdtgroup.c | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) -- 2.25.1

hulk inclusion category: bugfix bugzilla: https://gitee.com/openeuler/kernel/issues/IC30P1 -------------------------------- When the allocation of mbm_core fails due to insufficient system memory resources, it is necessary to also release the previously allocated mbm_total and mbm_local to prevent memory leakage. Fixes: 556688623b2b ("fs/resctrl: Create l2 cache monitors") Signed-off-by: Zeng Heng <zengheng4@huawei.com> --- fs/resctrl/rdtgroup.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/fs/resctrl/rdtgroup.c b/fs/resctrl/rdtgroup.c index b1f127432b42..549bde30da02 100644 --- a/fs/resctrl/rdtgroup.c +++ b/fs/resctrl/rdtgroup.c @@ -4034,7 +4034,8 @@ static int domain_setup_mon_state(struct rdt_resource *r, struct rdt_domain *d) d->mbm_core = kcalloc(idx_limit, tsize, GFP_KERNEL); if (!d->mbm_core) { bitmap_free(d->rmid_busy_llc); - kfree(d->mbm_core); + kfree(d->mbm_total); + kfree(d->mbm_local); return -ENOMEM; } } -- 2.25.1

hulk inclusion category: feature bugzilla: https://gitee.com/openeuler/kernel/issues/IC35SV -------------------------------- Each time a new control group is created, all the resctrl_res_level items need to be initialized with default values to prevent the partid from retaining old configurations due to previous usage. Signed-off-by: Zeng Heng <zengheng4@huawei.com> --- fs/resctrl/rdtgroup.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/fs/resctrl/rdtgroup.c b/fs/resctrl/rdtgroup.c index 549bde30da02..34580a06b246 100644 --- a/fs/resctrl/rdtgroup.c +++ b/fs/resctrl/rdtgroup.c @@ -3319,7 +3319,7 @@ static int rdtgroup_init_cat(struct resctrl_schema *s, u32 closid) } /* Initialize MBA resource with default values. */ -static void rdtgroup_init_mba(struct rdt_resource *r, u32 closid) +static void rdtgroup_init_res(struct rdt_resource *r, u32 closid) { struct resctrl_staged_config *cfg; struct rdt_domain *d; @@ -3347,15 +3347,16 @@ static int rdtgroup_init_alloc(struct rdtgroup *rdtgrp) list_for_each_entry(s, &resctrl_schema_all, list) { r = s->res; - if (r->rid == RDT_RESOURCE_MBA || - r->rid == RDT_RESOURCE_SMBA) { - rdtgroup_init_mba(r, rdtgrp->closid); - if (is_mba_sc(r)) - continue; - } else { + if (r->rid == RDT_RESOURCE_L2 || + r->rid == RDT_RESOURCE_L3) { ret = rdtgroup_init_cat(s, rdtgrp->closid); if (ret < 0) goto out; + + } else { + rdtgroup_init_res(r, rdtgrp->closid); + if (is_mba_sc(r)) + continue; } ret = resctrl_arch_update_domains(r, rdtgrp->closid); -- 2.25.1

hulk inclusion category: bugfix bugzilla: https://gitee.com/openeuler/kernel/issues/I8T2RT -------------------------------- The fixes tag patch resolves the lockdep warning. However, directly removing rdt_last_cmd_clear() would leave the last_cmd_status interface with stale logs, which does not conform to the functional definition before the fix. Therefore, the rdt_last_cmd_clear() operation is performed after successfully acquiring the rdtgroup_mutex. Fixes: c8eafe149530 ("x86/resctrl: Fix potential lockdep warning") Signed-off-by: Zeng Heng <zengheng4@huawei.com> --- fs/resctrl/rdtgroup.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/fs/resctrl/rdtgroup.c b/fs/resctrl/rdtgroup.c index 34580a06b246..39c83694956d 100644 --- a/fs/resctrl/rdtgroup.c +++ b/fs/resctrl/rdtgroup.c @@ -528,6 +528,8 @@ static ssize_t rdtgroup_cpus_write(struct kernfs_open_file *of, goto unlock; } + rdt_last_cmd_clear(); + if (rdtgrp->mode == RDT_MODE_PSEUDO_LOCKED || rdtgrp->mode == RDT_MODE_PSEUDO_LOCKSETUP) { ret = -EINVAL; @@ -3419,6 +3421,8 @@ static int mkdir_rdt_prepare(struct kernfs_node *parent_kn, goto out_unlock; } + rdt_last_cmd_clear(); + if (rtype == RDTMON_GROUP && (prdtgrp->mode == RDT_MODE_PSEUDO_LOCKSETUP || prdtgrp->mode == RDT_MODE_PSEUDO_LOCKED)) { -- 2.25.1

反馈: 您发送到kernel@openeuler.org的补丁/补丁集,已成功转换为PR! PR链接地址: https://gitee.com/openeuler/kernel/pulls/16513 邮件列表地址:https://mailweb.openeuler.org/archives/list/kernel@openeuler.org/message/46W... 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://gitee.com/openeuler/kernel/pulls/16513 Mailing list address: https://mailweb.openeuler.org/archives/list/kernel@openeuler.org/message/46W...
participants (2)
-
patchwork bot
-
Zeng Heng