Offering: HULK hulk inclusion category: bugfix bugzilla: https://gitee.com/openeuler/kernel/issues/I9ARW6
-----------------------------
When a new ctrl group is created under root group, it needs to allocate a new partid for that.
After that, the piece of code also needs to make refactoring indeed.
Fixes: a8c87e34b8f3 (arm64/mpam: Expand the monitor number of the resctrl root) Signed-off-by: Zeng Heng zengheng4@huawei.com --- fs/resctrlfs.c | 37 ++++++++++++++++++++++--------------- 1 file changed, 22 insertions(+), 15 deletions(-)
diff --git a/fs/resctrlfs.c b/fs/resctrlfs.c index bdb095f16f13..56f2a63ea43b 100644 --- a/fs/resctrlfs.c +++ b/fs/resctrlfs.c @@ -549,31 +549,38 @@ static int find_rdtgrp_allocable_rmid(struct resctrl_group *rdtgrp)
prgrp = rdtgrp->mon.parent;
- do { - rmid = rmid_alloc(prgrp->closid.reqpartid); - if (rmid >= 0) - break; + /* + * Create ctrl group under root group, just allocate new partid + */ + if (rdtgrp->type == RDTCTRL_GROUP) + goto rmid_realloc;
- head = &prgrp->mon.crdtgrp_list; - list_for_each_entry(entry, head, mon.crdtgrp_list) { - if (entry == rdtgrp) - continue; + rmid = rmid_alloc(prgrp->closid.reqpartid); + if (rmid >= 0) + goto rmid_attach;
- rmid = rmid_alloc(entry->closid.reqpartid); - if (rmid >= 0) - break; - } - } while (0); + head = &prgrp->mon.crdtgrp_list; + list_for_each_entry(entry, head, mon.crdtgrp_list) { + if (entry == rdtgrp) + continue;
+ rmid = rmid_alloc(entry->closid.reqpartid); + if (rmid >= 0) + goto rmid_attach; + } + +rmid_realloc: + rmid = rmid_alloc(-1); if (rmid < 0) - rmid = rmid_alloc(-1); + return rmid;
+rmid_attach: ret = mpam_rmid_to_partid_pmg(rmid, &reqpartid, NULL); if (ret) return ret; + rdtgrp->mon.rmid = rmid; rdtgrp->closid.reqpartid = reqpartid; - return rmid; }