aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kernel/cpu/intel_rdt.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/x86/kernel/cpu/intel_rdt.c')
-rw-r--r--arch/x86/kernel/cpu/intel_rdt.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/arch/x86/kernel/cpu/intel_rdt.c b/arch/x86/kernel/cpu/intel_rdt.c
index abb71ac70443..44272b7107ad 100644
--- a/arch/x86/kernel/cpu/intel_rdt.c
+++ b/arch/x86/kernel/cpu/intel_rdt.c
@@ -485,9 +485,7 @@ static int domain_setup_mon_state(struct rdt_resource *r, struct rdt_domain *d)
485 size_t tsize; 485 size_t tsize;
486 486
487 if (is_llc_occupancy_enabled()) { 487 if (is_llc_occupancy_enabled()) {
488 d->rmid_busy_llc = kcalloc(BITS_TO_LONGS(r->num_rmid), 488 d->rmid_busy_llc = bitmap_zalloc(r->num_rmid, GFP_KERNEL);
489 sizeof(unsigned long),
490 GFP_KERNEL);
491 if (!d->rmid_busy_llc) 489 if (!d->rmid_busy_llc)
492 return -ENOMEM; 490 return -ENOMEM;
493 INIT_DELAYED_WORK(&d->cqm_limbo, cqm_handle_limbo); 491 INIT_DELAYED_WORK(&d->cqm_limbo, cqm_handle_limbo);
@@ -496,7 +494,7 @@ static int domain_setup_mon_state(struct rdt_resource *r, struct rdt_domain *d)
496 tsize = sizeof(*d->mbm_total); 494 tsize = sizeof(*d->mbm_total);
497 d->mbm_total = kcalloc(r->num_rmid, tsize, GFP_KERNEL); 495 d->mbm_total = kcalloc(r->num_rmid, tsize, GFP_KERNEL);
498 if (!d->mbm_total) { 496 if (!d->mbm_total) {
499 kfree(d->rmid_busy_llc); 497 bitmap_free(d->rmid_busy_llc);
500 return -ENOMEM; 498 return -ENOMEM;
501 } 499 }
502 } 500 }
@@ -504,7 +502,7 @@ static int domain_setup_mon_state(struct rdt_resource *r, struct rdt_domain *d)
504 tsize = sizeof(*d->mbm_local); 502 tsize = sizeof(*d->mbm_local);
505 d->mbm_local = kcalloc(r->num_rmid, tsize, GFP_KERNEL); 503 d->mbm_local = kcalloc(r->num_rmid, tsize, GFP_KERNEL);
506 if (!d->mbm_local) { 504 if (!d->mbm_local) {
507 kfree(d->rmid_busy_llc); 505 bitmap_free(d->rmid_busy_llc);
508 kfree(d->mbm_total); 506 kfree(d->mbm_total);
509 return -ENOMEM; 507 return -ENOMEM;
510 } 508 }
@@ -610,9 +608,16 @@ static void domain_remove_cpu(int cpu, struct rdt_resource *r)
610 cancel_delayed_work(&d->cqm_limbo); 608 cancel_delayed_work(&d->cqm_limbo);
611 } 609 }
612 610
611 /*
612 * rdt_domain "d" is going to be freed below, so clear
613 * its pointer from pseudo_lock_region struct.
614 */
615 if (d->plr)
616 d->plr->d = NULL;
617
613 kfree(d->ctrl_val); 618 kfree(d->ctrl_val);
614 kfree(d->mbps_val); 619 kfree(d->mbps_val);
615 kfree(d->rmid_busy_llc); 620 bitmap_free(d->rmid_busy_llc);
616 kfree(d->mbm_total); 621 kfree(d->mbm_total);
617 kfree(d->mbm_local); 622 kfree(d->mbm_local);
618 kfree(d); 623 kfree(d);