Re: [PATCH v2 3/4] KVM: s390: Replace get_zeroed_page() with kzalloc() for the GIB

From: Janosch Frank

Date: Mon Sep 07 2026 - 10:49:27 EST


On 9/6/26 10:27 AM, Mike Rapoport (Microsoft) wrote:
kvm_s390_gib_init() allocates the guest information block (GIB). The GIB
is passed to the hardware as a physical address and must be page aligned.

kmalloc() guarantees that a power of two sized allocation is aligned to
its size, so a PAGE_SIZE allocation is page aligned as well.

This buffer can be allocated with kmalloc() as there's nothing special
about it to go directly to the page allocator.

kmalloc() provides a better API that does not require ugly casts and
kfree() does not need to know the size of the freed object.

Performance difference between kmalloc() and __get_free_pages() is not
measurable as both allocators take an object/page from a per-CPU list for
fast path allocations.

For the slow path the performance is anyway determined by the amount of
reclaim involved rather than by what allocator is used.

Replace use of get_zeroed_page() with kzalloc() and free_page() with
kfree().
Reviewed-by: Janosch Frank <frankja@xxxxxxxxxxxxx>