* [PATCH] KVM: PPC: Book3S HV: Use the bitmap API to allocate bitmaps
@ 2022-07-09 15:56 Christophe JAILLET
2022-12-08 12:39 ` Michael Ellerman
0 siblings, 1 reply; 2+ messages in thread
From: Christophe JAILLET @ 2022-07-09 15:56 UTC (permalink / raw)
To: Michael Ellerman, Benjamin Herrenschmidt, Paul Mackerras
Cc: Christophe JAILLET, linuxppc-dev, kernel-janitors, linux-kernel
Use bitmap_zalloc()/bitmap_free() instead of hand-writing them.
It is less verbose and it improves the semantic.
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
arch/powerpc/kvm/book3s_hv_uvmem.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/arch/powerpc/kvm/book3s_hv_uvmem.c b/arch/powerpc/kvm/book3s_hv_uvmem.c
index 598006301620..95de5fac6497 100644
--- a/arch/powerpc/kvm/book3s_hv_uvmem.c
+++ b/arch/powerpc/kvm/book3s_hv_uvmem.c
@@ -1187,8 +1187,7 @@ int kvmppc_uvmem_init(void)
pfn_first = res->start >> PAGE_SHIFT;
pfn_last = pfn_first + (resource_size(res) >> PAGE_SHIFT);
- kvmppc_uvmem_bitmap = kcalloc(BITS_TO_LONGS(pfn_last - pfn_first),
- sizeof(unsigned long), GFP_KERNEL);
+ kvmppc_uvmem_bitmap = bitmap_zalloc(pfn_last - pfn_first, GFP_KERNEL);
if (!kvmppc_uvmem_bitmap) {
ret = -ENOMEM;
goto out_unmap;
@@ -1212,5 +1211,5 @@ void kvmppc_uvmem_free(void)
memunmap_pages(&kvmppc_uvmem_pgmap);
release_mem_region(kvmppc_uvmem_pgmap.range.start,
range_len(&kvmppc_uvmem_pgmap.range));
- kfree(kvmppc_uvmem_bitmap);
+ bitmap_free(kvmppc_uvmem_bitmap);
}
--
2.34.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] KVM: PPC: Book3S HV: Use the bitmap API to allocate bitmaps
2022-07-09 15:56 [PATCH] KVM: PPC: Book3S HV: Use the bitmap API to allocate bitmaps Christophe JAILLET
@ 2022-12-08 12:39 ` Michael Ellerman
0 siblings, 0 replies; 2+ messages in thread
From: Michael Ellerman @ 2022-12-08 12:39 UTC (permalink / raw)
To: Benjamin Herrenschmidt, Michael Ellerman, Christophe JAILLET,
Paul Mackerras
Cc: kernel-janitors, linuxppc-dev, linux-kernel
On Sat, 9 Jul 2022 17:56:43 +0200, Christophe JAILLET wrote:
> Use bitmap_zalloc()/bitmap_free() instead of hand-writing them.
>
> It is less verbose and it improves the semantic.
>
>
Applied to powerpc/next.
[1/1] KVM: PPC: Book3S HV: Use the bitmap API to allocate bitmaps
https://git.kernel.org/powerpc/c/a96b20758b23be7e9f693218908228d6100c3c26
cheers
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-12-08 12:52 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-09 15:56 [PATCH] KVM: PPC: Book3S HV: Use the bitmap API to allocate bitmaps Christophe JAILLET
2022-12-08 12:39 ` Michael Ellerman
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).