Commit 81f45e29 authored by Zeng Heng's avatar Zeng Heng
Browse files

arm64/mpam: Allocate new partid for the created ctrl group

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: a8c87e34 (arm64/mpam: Expand the monitor number of the resctrl root)
Signed-off-by: default avatarZeng Heng <zengheng4@huawei.com>
parent 10459c38
Loading
Loading
Loading
Loading
+22 −15
Original line number Diff line number Diff line
@@ -549,10 +549,15 @@ static int find_rdtgrp_allocable_rmid(struct resctrl_group *rdtgrp)

	prgrp = rdtgrp->mon.parent;

	do {
	/*
	 * Create ctrl group under root group, just allocate new partid
	 */
	if (rdtgrp->type == RDTCTRL_GROUP)
		goto rmid_realloc;

	rmid = rmid_alloc(prgrp->closid.reqpartid);
	if (rmid >= 0)
			break;
		goto rmid_attach;

	head = &prgrp->mon.crdtgrp_list;
	list_for_each_entry(entry, head, mon.crdtgrp_list) {
@@ -561,19 +566,21 @@ static int find_rdtgrp_allocable_rmid(struct resctrl_group *rdtgrp)

		rmid = rmid_alloc(entry->closid.reqpartid);
		if (rmid >= 0)
				break;
			goto rmid_attach;
	}
	} while (0);

	if (rmid < 0)
rmid_realloc:
	rmid = rmid_alloc(-1);
	if (rmid < 0)
		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;
}