Re: [PATCH v2 10/14] s390/sclp_cmd: Replace page allocator calls with kzalloc()

From: Heiko Carstens

Date: Tue Nov 17 2026 - 10:33:27 EST


On Tue, Nov 17, 2026 at 03:07:02PM +0200, Mike Rapoport (Microsoft) wrote:
> _sclp_get_core_info(), do_chp_configure() and sclp_chp_read_info()
> allocate the SCCBs used to read the CPU information, to configure a
> channel path and to read the channel path information.
>
> These buffers can be allocated with kmalloc() as there's nothing special
> about them 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.
>
> Keep a power of two size for the SCCB in _sclp_get_core_info() so that
> kmalloc() returns a page aligned buffer.
>
> Replace use of __get_free_pages() and get_zeroed_page() with kzalloc()
> and free_page[s]() with kfree().
>
> Link: https://lore.kernel.org/all/635405e4-9423-4a25-a6e7-e03c8ea0bcbe@xxxxxxxxxx
> Signed-off-by: Mike Rapoport (Microsoft) <rppt@xxxxxxxxxx>
> ---
> drivers/s390/char/sclp_cmd.c | 13 +++++++------
> 1 file changed, 7 insertions(+), 6 deletions(-)

Reviewed-by: Heiko Carstens <hca@xxxxxxxxxxxxx>