Skip to content

Commit 8215987

Browse files
andy-shevKAGA-KOKO
authored andcommitted
x86/intel_rdt: Switch to bitmap_zalloc()
Switch to bitmap_zalloc() to show clearly what is allocated. Besides that it returns a pointer of bitmap type instead of opaque void *. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Acked-by: Fenghua Yu <fenghua.yu@intel.com> Cc: "H. Peter Anvin" <hpa@zytor.com> Link: https://lkml.kernel.org/r/20180830115039.63430-1-andriy.shevchenko@linux.intel.com
1 parent 53ed74a commit 8215987

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

arch/x86/kernel/cpu/intel_rdt.c

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -485,9 +485,7 @@ static int domain_setup_mon_state(struct rdt_resource *r, struct rdt_domain *d)
485485
size_t tsize;
486486

487487
if (is_llc_occupancy_enabled()) {
488-
d->rmid_busy_llc = kcalloc(BITS_TO_LONGS(r->num_rmid),
489-
sizeof(unsigned long),
490-
GFP_KERNEL);
488+
d->rmid_busy_llc = bitmap_zalloc(r->num_rmid, GFP_KERNEL);
491489
if (!d->rmid_busy_llc)
492490
return -ENOMEM;
493491
INIT_DELAYED_WORK(&d->cqm_limbo, cqm_handle_limbo);
@@ -496,15 +494,15 @@ static int domain_setup_mon_state(struct rdt_resource *r, struct rdt_domain *d)
496494
tsize = sizeof(*d->mbm_total);
497495
d->mbm_total = kcalloc(r->num_rmid, tsize, GFP_KERNEL);
498496
if (!d->mbm_total) {
499-
kfree(d->rmid_busy_llc);
497+
bitmap_free(d->rmid_busy_llc);
500498
return -ENOMEM;
501499
}
502500
}
503501
if (is_mbm_local_enabled()) {
504502
tsize = sizeof(*d->mbm_local);
505503
d->mbm_local = kcalloc(r->num_rmid, tsize, GFP_KERNEL);
506504
if (!d->mbm_local) {
507-
kfree(d->rmid_busy_llc);
505+
bitmap_free(d->rmid_busy_llc);
508506
kfree(d->mbm_total);
509507
return -ENOMEM;
510508
}
@@ -612,7 +610,7 @@ static void domain_remove_cpu(int cpu, struct rdt_resource *r)
612610

613611
kfree(d->ctrl_val);
614612
kfree(d->mbps_val);
615-
kfree(d->rmid_busy_llc);
613+
bitmap_free(d->rmid_busy_llc);
616614
kfree(d->mbm_total);
617615
kfree(d->mbm_local);
618616
kfree(d);

0 commit comments

Comments
 (0)