rdtgroup_rmdir deletes a group and frees the closid, but doesn't
reiniaialize domain's cbm to default for the closid. Next time the
closid is allocated again, 'schemata' will show old cbm. We can do the
reinitialization at free/alloc closid, but sounds doing it at alloc is
more nartual.

Cc: Fenghua Yu <[email protected]>
Cc: Thomas Gleixner <[email protected]>
Signed-off-by: Shaohua Li <[email protected]>
---
 arch/x86/kernel/cpu/intel_rdt_rdtgroup.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/arch/x86/kernel/cpu/intel_rdt_rdtgroup.c 
b/arch/x86/kernel/cpu/intel_rdt_rdtgroup.c
index 8af04af..7e81527 100644
--- a/arch/x86/kernel/cpu/intel_rdt_rdtgroup.c
+++ b/arch/x86/kernel/cpu/intel_rdt_rdtgroup.c
@@ -78,12 +78,21 @@ static void closid_init(void)
 int closid_alloc(void)
 {
        int closid = ffs(closid_free_map);
+       struct rdt_resource *r;
+       struct rdt_domain *dom;
 
        if (closid == 0)
                return -ENOSPC;
        closid--;
        closid_free_map &= ~(1 << closid);
 
+       for_each_enabled_rdt_resource(r) {
+               if (closid >= r->num_closid)
+                       continue;
+               list_for_each_entry(dom, &r->domains, list)
+                       dom->cbm[closid] = r->max_cbm;
+       }
+
        return closid;
 }
 
-- 
2.9.3

Reply via email to