* [PATCH v1] x86/intel_rdt: Switch to bitmap_zalloc()
@ 2018-08-30 11:50 Andy Shevchenko
2018-09-06 20:28 ` Fenghua Yu
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Andy Shevchenko @ 2018-08-30 11:50 UTC (permalink / raw)
To: Fenghua Yu, linux-kernel, Thomas Gleixner, Ingo Molnar,
H. Peter Anvin, x86
Cc: Andy Shevchenko
Switch to bitmap_zalloc() to show clearly what we are allocating.
Besides that it returns pointer of bitmap type instead of opaque void *.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
arch/x86/kernel/cpu/intel_rdt.c | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)
diff --git a/arch/x86/kernel/cpu/intel_rdt.c b/arch/x86/kernel/cpu/intel_rdt.c
index abb71ac70443..1214f3f7ec6d 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)
size_t tsize;
if (is_llc_occupancy_enabled()) {
- d->rmid_busy_llc = kcalloc(BITS_TO_LONGS(r->num_rmid),
- sizeof(unsigned long),
- GFP_KERNEL);
+ d->rmid_busy_llc = bitmap_zalloc(r->num_rmid, GFP_KERNEL);
if (!d->rmid_busy_llc)
return -ENOMEM;
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)
tsize = sizeof(*d->mbm_total);
d->mbm_total = kcalloc(r->num_rmid, tsize, GFP_KERNEL);
if (!d->mbm_total) {
- kfree(d->rmid_busy_llc);
+ bitmap_free(d->rmid_busy_llc);
return -ENOMEM;
}
}
@@ -504,7 +502,7 @@ static int domain_setup_mon_state(struct rdt_resource *r, struct rdt_domain *d)
tsize = sizeof(*d->mbm_local);
d->mbm_local = kcalloc(r->num_rmid, tsize, GFP_KERNEL);
if (!d->mbm_local) {
- kfree(d->rmid_busy_llc);
+ bitmap_free(d->rmid_busy_llc);
kfree(d->mbm_total);
return -ENOMEM;
}
@@ -612,7 +610,7 @@ static void domain_remove_cpu(int cpu, struct rdt_resource *r)
kfree(d->ctrl_val);
kfree(d->mbps_val);
- kfree(d->rmid_busy_llc);
+ bitmap_free(d->rmid_busy_llc);
kfree(d->mbm_total);
kfree(d->mbm_local);
kfree(d);
--
2.18.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH v1] x86/intel_rdt: Switch to bitmap_zalloc()
2018-08-30 11:50 [PATCH v1] x86/intel_rdt: Switch to bitmap_zalloc() Andy Shevchenko
@ 2018-09-06 20:28 ` Fenghua Yu
2018-10-03 14:22 ` [tip:x86/cache] " tip-bot for Andy Shevchenko
2018-10-03 19:58 ` tip-bot for Andy Shevchenko
2 siblings, 0 replies; 4+ messages in thread
From: Fenghua Yu @ 2018-09-06 20:28 UTC (permalink / raw)
To: Andy Shevchenko
Cc: Fenghua Yu, linux-kernel, Thomas Gleixner, Ingo Molnar,
H. Peter Anvin, x86
On Thu, Aug 30, 2018 at 02:50:39PM +0300, Andy Shevchenko wrote:
> Switch to bitmap_zalloc() to show clearly what we are allocating.
> Besides that it returns pointer of bitmap type instead of opaque void *.
>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> ---
> arch/x86/kernel/cpu/intel_rdt.c | 10 ++++------
> 1 file changed, 4 insertions(+), 6 deletions(-)
>
Acked-by: Fenghua Yu <fenghua.yu@intel.com>
^ permalink raw reply [flat|nested] 4+ messages in thread
* [tip:x86/cache] x86/intel_rdt: Switch to bitmap_zalloc()
2018-08-30 11:50 [PATCH v1] x86/intel_rdt: Switch to bitmap_zalloc() Andy Shevchenko
2018-09-06 20:28 ` Fenghua Yu
@ 2018-10-03 14:22 ` tip-bot for Andy Shevchenko
2018-10-03 19:58 ` tip-bot for Andy Shevchenko
2 siblings, 0 replies; 4+ messages in thread
From: tip-bot for Andy Shevchenko @ 2018-10-03 14:22 UTC (permalink / raw)
To: linux-tip-commits
Cc: hpa, linux-kernel, andriy.shevchenko, mingo, fenghua.yu, tglx
Commit-ID: 7b6f10b3e6ee031928642e90a0a7233c767dc4ff
Gitweb: https://git.kernel.org/tip/7b6f10b3e6ee031928642e90a0a7233c767dc4ff
Author: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
AuthorDate: Thu, 30 Aug 2018 14:50:39 +0300
Committer: Thomas Gleixner <tglx@linutronix.de>
CommitDate: Wed, 3 Oct 2018 16:19:35 +0200
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
---
arch/x86/kernel/cpu/intel_rdt.c | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)
diff --git a/arch/x86/kernel/cpu/intel_rdt.c b/arch/x86/kernel/cpu/intel_rdt.c
index abb71ac70443..1214f3f7ec6d 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)
size_t tsize;
if (is_llc_occupancy_enabled()) {
- d->rmid_busy_llc = kcalloc(BITS_TO_LONGS(r->num_rmid),
- sizeof(unsigned long),
- GFP_KERNEL);
+ d->rmid_busy_llc = bitmap_zalloc(r->num_rmid, GFP_KERNEL);
if (!d->rmid_busy_llc)
return -ENOMEM;
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)
tsize = sizeof(*d->mbm_total);
d->mbm_total = kcalloc(r->num_rmid, tsize, GFP_KERNEL);
if (!d->mbm_total) {
- kfree(d->rmid_busy_llc);
+ bitmap_free(d->rmid_busy_llc);
return -ENOMEM;
}
}
@@ -504,7 +502,7 @@ static int domain_setup_mon_state(struct rdt_resource *r, struct rdt_domain *d)
tsize = sizeof(*d->mbm_local);
d->mbm_local = kcalloc(r->num_rmid, tsize, GFP_KERNEL);
if (!d->mbm_local) {
- kfree(d->rmid_busy_llc);
+ bitmap_free(d->rmid_busy_llc);
kfree(d->mbm_total);
return -ENOMEM;
}
@@ -612,7 +610,7 @@ static void domain_remove_cpu(int cpu, struct rdt_resource *r)
kfree(d->ctrl_val);
kfree(d->mbps_val);
- kfree(d->rmid_busy_llc);
+ bitmap_free(d->rmid_busy_llc);
kfree(d->mbm_total);
kfree(d->mbm_local);
kfree(d);
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [tip:x86/cache] x86/intel_rdt: Switch to bitmap_zalloc()
2018-08-30 11:50 [PATCH v1] x86/intel_rdt: Switch to bitmap_zalloc() Andy Shevchenko
2018-09-06 20:28 ` Fenghua Yu
2018-10-03 14:22 ` [tip:x86/cache] " tip-bot for Andy Shevchenko
@ 2018-10-03 19:58 ` tip-bot for Andy Shevchenko
2 siblings, 0 replies; 4+ messages in thread
From: tip-bot for Andy Shevchenko @ 2018-10-03 19:58 UTC (permalink / raw)
To: linux-tip-commits
Cc: andriy.shevchenko, fenghua.yu, linux-kernel, mingo, hpa, tglx
Commit-ID: 82159876d32b7959c0b0ea8fe12c428f41502a6f
Gitweb: https://git.kernel.org/tip/82159876d32b7959c0b0ea8fe12c428f41502a6f
Author: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
AuthorDate: Thu, 30 Aug 2018 14:50:39 +0300
Committer: Thomas Gleixner <tglx@linutronix.de>
CommitDate: Wed, 3 Oct 2018 21:53:49 +0200
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
---
arch/x86/kernel/cpu/intel_rdt.c | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)
diff --git a/arch/x86/kernel/cpu/intel_rdt.c b/arch/x86/kernel/cpu/intel_rdt.c
index abb71ac70443..1214f3f7ec6d 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)
size_t tsize;
if (is_llc_occupancy_enabled()) {
- d->rmid_busy_llc = kcalloc(BITS_TO_LONGS(r->num_rmid),
- sizeof(unsigned long),
- GFP_KERNEL);
+ d->rmid_busy_llc = bitmap_zalloc(r->num_rmid, GFP_KERNEL);
if (!d->rmid_busy_llc)
return -ENOMEM;
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)
tsize = sizeof(*d->mbm_total);
d->mbm_total = kcalloc(r->num_rmid, tsize, GFP_KERNEL);
if (!d->mbm_total) {
- kfree(d->rmid_busy_llc);
+ bitmap_free(d->rmid_busy_llc);
return -ENOMEM;
}
}
@@ -504,7 +502,7 @@ static int domain_setup_mon_state(struct rdt_resource *r, struct rdt_domain *d)
tsize = sizeof(*d->mbm_local);
d->mbm_local = kcalloc(r->num_rmid, tsize, GFP_KERNEL);
if (!d->mbm_local) {
- kfree(d->rmid_busy_llc);
+ bitmap_free(d->rmid_busy_llc);
kfree(d->mbm_total);
return -ENOMEM;
}
@@ -612,7 +610,7 @@ static void domain_remove_cpu(int cpu, struct rdt_resource *r)
kfree(d->ctrl_val);
kfree(d->mbps_val);
- kfree(d->rmid_busy_llc);
+ bitmap_free(d->rmid_busy_llc);
kfree(d->mbm_total);
kfree(d->mbm_local);
kfree(d);
^ permalink raw reply related [flat|nested] 4+ messages in thread
end of thread, other threads:[~2018-10-03 19:58 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-08-30 11:50 [PATCH v1] x86/intel_rdt: Switch to bitmap_zalloc() Andy Shevchenko
2018-09-06 20:28 ` Fenghua Yu
2018-10-03 14:22 ` [tip:x86/cache] " tip-bot for Andy Shevchenko
2018-10-03 19:58 ` tip-bot for Andy Shevchenko
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).