From: Mike Rapoport (Microsoft) Date: Sun, 31 May 2026 14:08:25 +0000 (+0300) Subject: s390/qeth: Replace get_zeroed_page() with kzalloc() X-Git-Url: http://git.ipfire.org/gitweb/?a=commitdiff_plain;h=cccb81940ac2c454f3003dd945b7f354958e3576;p=thirdparty%2Flinux.git s390/qeth: Replace get_zeroed_page() with kzalloc() qeth_get_trap_id() allocates a temporary buffer for STSI system information queries used to build trap identification strings. 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(). Link: https://lore.kernel.org/all/635405e4-9423-4a25-a6e7-e03c8ea0bcbe@redhat.com Acked-by: Alexandra Winter Signed-off-by: Mike Rapoport (Microsoft) Reviewed-by: Heiko Carstens Signed-off-by: Alexander Gordeev --- diff --git a/drivers/s390/net/qeth_core_main.c b/drivers/s390/net/qeth_core_main.c index cf5f760d0e020..20fb0d2e02a9a 100644 --- a/drivers/s390/net/qeth_core_main.c +++ b/drivers/s390/net/qeth_core_main.c @@ -3362,9 +3362,9 @@ static int qeth_query_setdiagass(struct qeth_card *card) static void qeth_get_trap_id(struct qeth_card *card, struct qeth_trap_id *tid) { - unsigned long info = get_zeroed_page(GFP_KERNEL); - struct sysinfo_2_2_2 *info222 = (struct sysinfo_2_2_2 *)info; - struct sysinfo_3_2_2 *info322 = (struct sysinfo_3_2_2 *)info; + void *info = kzalloc(PAGE_SIZE, GFP_KERNEL); + struct sysinfo_2_2_2 *info222 = info; + struct sysinfo_3_2_2 *info322 = info; struct ccw_dev_id ccwid; int level; @@ -3381,7 +3381,7 @@ static void qeth_get_trap_id(struct qeth_card *card, struct qeth_trap_id *tid) EBCASC(info322->vm[0].name, sizeof(info322->vm[0].name)); memcpy(tid->vmname, info322->vm[0].name, sizeof(tid->vmname)); } - free_page(info); + kfree(info); } static int qeth_hw_trap_cb(struct qeth_card *card,