Linux s390 Architecture development
 help / color / mirror / Atom feed
From: Heiko Carstens <hca@linux.ibm.com>
To: "Mike Rapoport (Microsoft)" <rppt@kernel.org>
Cc: Alexander Gordeev <agordeev@linux.ibm.com>,
	Vasily Gorbik <gor@linux.ibm.com>,
	Alexandra Winter <wintera@linux.ibm.com>,
	Aswin Karuvally <aswin@linux.ibm.com>,
	Christian Borntraeger <borntraeger@linux.ibm.com>,
	Harald Freudenberger <freude@linux.ibm.com>,
	Holger Dengler <dengler@linux.ibm.com>,
	Jan Hoeppner <hoeppner@linux.ibm.com>,
	Stefan Haberland <sth@linux.ibm.com>,
	Sven Schnelle <svens@linux.ibm.com>,
	linux-s390@vger.kernel.org, Vlastimil Babka <vbabka@kernel.org>
Subject: Re: [PATCH 4/6] s390/qeth: replace get_zeroed_page() with kzalloc()
Date: Fri, 29 May 2026 13:09:11 +0200	[thread overview]
Message-ID: <20260529110911.26496Hac-hca@linux.ibm.com> (raw)
In-Reply-To: <20260528-b4-s390-drivers-v1-4-b7108f54d722@kernel.org>

On Thu, May 28, 2026 at 10:09:52AM +0300, Mike Rapoport (Microsoft) wrote:
> 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
> Signed-off-by: Mike Rapoport (Microsoft) <rppt@kernel.org>
> ---
>  drivers/s390/net/qeth_core_main.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/s390/net/qeth_core_main.c b/drivers/s390/net/qeth_core_main.c
> index cf5f760d0e02..9274087557ec 100644
> --- a/drivers/s390/net/qeth_core_main.c
> +++ b/drivers/s390/net/qeth_core_main.c
> @@ -3362,7 +3362,7 @@ 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);
> +	unsigned long info = (unsigned long)kzalloc(PAGE_SIZE, 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;
>  	struct ccw_dev_id ccwid;
> @@ -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((void *)info);
>  }

Hm, another thing is that Sashiko claims that kmalloc allocations are not
necessarily correctly aligned when slab debugging or KASAN is enabled [1].

I believe that Sashiko is wrong, since Vlastimil addressed that with commit
59bb47985c1d ("mm, sl[aou]b: guarantee natural alignment for kmalloc(power-of-two)")

Can you confirm that Sashiko is wrong?

[1] https://sashiko.dev/#/patchset/20260528-b4-s390-drivers-v1-0-b7108f54d722%40kernel.org?part=4

  parent reply	other threads:[~2026-05-29 11:09 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-28  7:09 [PATCH 0/6] s390/drivers: replace __get_free_pages() call with kmalloc() Mike Rapoport (Microsoft)
2026-05-28  7:09 ` [PATCH 1/6] s390/con3270: replace __get_free_page() " Mike Rapoport (Microsoft)
2026-05-29 10:26   ` Heiko Carstens
2026-05-28  7:09 ` [PATCH 2/6] s390/dasd: replace get_zeroed_page() with kzalloc() Mike Rapoport (Microsoft)
2026-05-29 10:15   ` Heiko Carstens
2026-05-31 10:35     ` Mike Rapoport
2026-05-28  7:09 ` [PATCH 3/6] s390/hvc_iucv: " Mike Rapoport (Microsoft)
2026-05-29 10:26   ` Heiko Carstens
2026-05-28  7:09 ` [PATCH 4/6] s390/qeth: " Mike Rapoport (Microsoft)
2026-05-28 14:17   ` Alexandra Winter
2026-05-29 10:23   ` Heiko Carstens
2026-05-31 10:17     ` Mike Rapoport
2026-05-29 11:09   ` Heiko Carstens [this message]
2026-05-29 11:15     ` Vlastimil Babka (SUSE)
2026-05-28  7:09 ` [PATCH 5/6] s390/trng: replace __get_free_page() with kmalloc() Mike Rapoport (Microsoft)
2026-05-29 10:29   ` Heiko Carstens
2026-05-28  7:09 ` [PATCH 6/6] s390/zcrypt: replace get_zeroed_page() with kzalloc() Mike Rapoport (Microsoft)
2026-05-29  8:29   ` Harald Freudenberger
2026-05-29 10:28   ` Heiko Carstens
2026-05-28 14:48 ` [PATCH 0/6] s390/drivers: replace __get_free_pages() call with kmalloc() Alexander Gordeev
2026-05-28 15:16   ` Mike Rapoport
2026-05-29  6:21     ` Alexander Gordeev
2026-05-29  7:13       ` Mike Rapoport

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260529110911.26496Hac-hca@linux.ibm.com \
    --to=hca@linux.ibm.com \
    --cc=agordeev@linux.ibm.com \
    --cc=aswin@linux.ibm.com \
    --cc=borntraeger@linux.ibm.com \
    --cc=dengler@linux.ibm.com \
    --cc=freude@linux.ibm.com \
    --cc=gor@linux.ibm.com \
    --cc=hoeppner@linux.ibm.com \
    --cc=linux-s390@vger.kernel.org \
    --cc=rppt@kernel.org \
    --cc=sth@linux.ibm.com \
    --cc=svens@linux.ibm.com \
    --cc=vbabka@kernel.org \
    --cc=wintera@linux.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox