[PATCH 09/13] s390/qdio_main: Use kzalloc() for the QDR
From: Mike Rapoport (Microsoft)
Date: Mon Sep 07 2026 - 06:27:26 EST
qdio_allocate() allocates the queue description record (QDR).
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/qdio_main.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/s390/cio/qdio_main.c b/drivers/s390/cio/qdio_main.c
index 6b9442bae7ffd..bebc1250ebebf 100644
--- a/drivers/s390/cio/qdio_main.c
+++ b/drivers/s390/cio/qdio_main.c
@@ -934,7 +934,7 @@ int qdio_free(struct ccw_device *cdev)
mutex_unlock(&irq_ptr->setup_mutex);
qdio_free_queues(irq_ptr);
- free_page((unsigned long) irq_ptr->qdr);
+ kfree(irq_ptr->qdr);
kfree(irq_ptr->chsc_page);
kfree(irq_ptr->ccw);
kfree(irq_ptr);
@@ -992,7 +992,7 @@ int qdio_allocate(struct ccw_device *cdev, unsigned int no_input_qs,
goto err_chsc;
/* qdr is used in ccw1.cda which is u32 */
- irq_ptr->qdr = (struct qdr *) get_zeroed_page(GFP_KERNEL | GFP_DMA);
+ irq_ptr->qdr = kzalloc(PAGE_SIZE, GFP_KERNEL | GFP_DMA);
if (!irq_ptr->qdr)
goto err_qdr;
@@ -1005,7 +1005,7 @@ int qdio_allocate(struct ccw_device *cdev, unsigned int no_input_qs,
return 0;
err_queues:
- free_page((unsigned long) irq_ptr->qdr);
+ kfree(irq_ptr->qdr);
err_qdr:
kfree(irq_ptr->chsc_page);
err_chsc:
--
2.53.0