[PATCH 08/14] s390/sclp_sdias: Replace __get_free_page() with kmalloc()
From: Mike Rapoport (Microsoft)
Date: Sun Nov 08 2026 - 04:07:55 EST
sclp_sdias_init() allocates the SCCB used for the SCLP store dump
information requests.
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_free_page() with kmalloc() and free_page() 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_sdias.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/s390/char/sclp_sdias.c b/drivers/s390/char/sclp_sdias.c
index ab8f1b758a1a8..a1a17a9e4a910 100644
--- a/drivers/s390/char/sclp_sdias.c
+++ b/drivers/s390/char/sclp_sdias.c
@@ -10,6 +10,7 @@
#include <linux/completion.h>
#include <linux/sched.h>
+#include <linux/slab.h>
#include <asm/sclp.h>
#include <asm/debug.h>
#include <asm/ipl.h>
@@ -258,7 +259,7 @@ int __init sclp_sdias_init(void)
{
if (!is_ipl_type_dump())
return 0;
- sclp_sdias_sccb = (void *) __get_free_page(GFP_KERNEL | GFP_DMA);
+ sclp_sdias_sccb = kmalloc(PAGE_SIZE, GFP_KERNEL | GFP_DMA);
BUG_ON(!sclp_sdias_sccb);
sdias_dbf = debug_register("dump_sdias", 4, 1, 4 * sizeof(long));
debug_register_view(sdias_dbf, &debug_sprintf_view);
@@ -268,7 +269,7 @@ int __init sclp_sdias_init(void)
if (sclp_sdias_init_async() == 0)
goto out;
TRACE("init failed\n");
- free_page((unsigned long) sclp_sdias_sccb);
+ kfree(sclp_sdias_sccb);
return -ENODEV;
out:
TRACE("init done\n");
--
2.53.0