[PATCH 02/13] s390/chsc: Use kzalloc() for the SEI work area
From: Mike Rapoport (Microsoft)
Date: Mon Sep 07 2026 - 06:31:16 EST
chsc_init() allocates the work area for store event information data.
This memory 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().
Link: https://lore.kernel.org/all/635405e4-9423-4a25-a6e7-e03c8ea0bcbe@xxxxxxxxxx
Assisted-by: copilot:claude-opus
Signed-off-by: Mike Rapoport (Microsoft) <rppt@xxxxxxxxxx>
---
drivers/s390/cio/chsc.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/s390/cio/chsc.c b/drivers/s390/cio/chsc.c
index 60a4a7e6086ce..c3186c0a372b4 100644
--- a/drivers/s390/cio/chsc.c
+++ b/drivers/s390/cio/chsc.c
@@ -1142,7 +1142,7 @@ int __init chsc_init(void)
{
int ret;
- sei_page = (void *)get_zeroed_page(GFP_KERNEL | GFP_DMA);
+ sei_page = kzalloc(PAGE_SIZE, GFP_KERNEL | GFP_DMA);
chsc_page = (void *)get_zeroed_page(GFP_KERNEL | GFP_DMA);
if (!sei_page || !chsc_page) {
ret = -ENOMEM;
@@ -1154,7 +1154,7 @@ int __init chsc_init(void)
return ret;
out_err:
free_page((unsigned long)chsc_page);
- free_page((unsigned long)sei_page);
+ kfree(sei_page);
return ret;
}
@@ -1162,7 +1162,7 @@ void __init chsc_init_cleanup(void)
{
crw_unregister_handler(CRW_RSC_CSS);
free_page((unsigned long)chsc_page);
- free_page((unsigned long)sei_page);
+ kfree(sei_page);
}
int __chsc_enable_facility(struct chsc_sda_area *sda_area, int operation_code)
--
2.53.0