From nobody Sat Sep 26 23:18:34 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 67F912D6E64 for ; Sun, 30 Aug 2026 07:48:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788076090; cv=none; b=JLgC0Kpxzw6Fmw7u40bhOb/5esOD4i+sIP9QZc33ZNx54GhI4tTJIb2cL/xLXsnYGgbEAb4JNnFdBUOO36n8e1sF0P/yf3c0muf+41co7gpE5yahCRwJwwUEmcsCzirNE2Ls1Ok1eZfMAJA7s+hPiV2fd8Jkh4P43fzlwSwXsOk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788076090; c=relaxed/simple; bh=gxl10T1a4q7qNQWYriqqtddynigDOr+IYYOIKMq1Gms=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=h7I7Occ1cvY6dC8zsQm5yPdSOR+qihsVnbDWzt/kx/CQDbBO9dLAldGynOjlxePsrfWNrJ4Sdf7CXI6IMvi+eU4wmExcKvSOsqrQdhLh1DjrDyLAj3J6+3R0vf4zQwWHOiT3qFRocDNOt6dl/pw73bbX1lnz1X/wG0Cscwa4u00= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=C5WEFdIx; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="C5WEFdIx" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8E3281F000E9; Sun, 30 Aug 2026 07:48:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1788076089; bh=lBV4SRjso+EkgLj4PkYZQJzo+GNlBWOlH+QTKJh25O4=; h=From:Date:Subject:References:In-Reply-To:To:Cc; b=C5WEFdIxnZu7NyCEa0917/q9m8RAavDxTcdqoLLl699TQIsq4EeOhuxI+szK6oUPX BBIzv3+IJ6+fS9FQmBehVilOS0JWGi1UM3ADz5QENEJkQ7B/lCi6MWuSsmh9d24gC/ xqZO9ZbJgzAnKUPKUwFxOq36/mp/Mjxngs08R/Q2YejbbFqe90lyuLn5rhvLGud3X2 EVKuB+T3cucf4i8ZuJBhzJEXqmfg9dO6oauWM/ZNRbde/XgSesB8Mx+xxgTVU6krb/ +wgLp1Rk81AU4bDORSu6mDLNfdNz2kcvtvVoz/m10gaevkyEoeDi6cwxlvkD5TYLbP 9ZbWSJno7s5+w== From: "Mike Rapoport (Microsoft)" Date: Sun, 30 Aug 2026 10:47:58 +0300 Subject: [PATCH 1/4] char: xilinx_hwicap: replace page allocator calls with k[mz]alloc() Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260830-char-misc-v1-1-05e2ce44f291@kernel.org> References: <20260830-char-misc-v1-0-05e2ce44f291@kernel.org> In-Reply-To: <20260830-char-misc-v1-0-05e2ce44f291@kernel.org> To: Arnd Bergmann , Brad Warrum , Eli Billauer , Greg Kroah-Hartman , Michal Simek , Ritu Agarwal Cc: Andrew Morton , David Hildenbrand , Matthew Wilcox , Mike Rapoport , Vlastimil Babka , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, linuxppc-dev@lists.ozlabs.org X-Mailer: b4 0.17-dev hwicap_read() and hwicap_write() allocate temporary buffers used to pass the FPGA configuration data to and from userspace. These buffers can be allocated with kmalloc() as there's nothing special about them 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() and get_zeroed_page() with kmalloc() and kzalloc() and free_page() with kfree(). Link: https://lore.kernel.org/all/635405e4-9423-4a25-a6e7-e03c8ea0bcbe@redh= at.com Assisted-by: copilot:claude-opus Signed-off-by: Mike Rapoport (Microsoft) --- drivers/char/xilinx_hwicap/xilinx_hwicap.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/drivers/char/xilinx_hwicap/xilinx_hwicap.c b/drivers/char/xili= nx_hwicap/xilinx_hwicap.c index 9bb5fa642fd8..bbeb9b6060dc 100644 --- a/drivers/char/xilinx_hwicap/xilinx_hwicap.c +++ b/drivers/char/xilinx_hwicap/xilinx_hwicap.c @@ -382,7 +382,7 @@ hwicap_read(struct file *file, char __user *buf, size_t= count, loff_t *ppos) 4 - bytes_to_read); } else { /* Get new data from the ICAP, and return what was requested. */ - kbuf =3D (u32 *) get_zeroed_page(GFP_KERNEL); + kbuf =3D kzalloc(PAGE_SIZE, GFP_KERNEL); if (!kbuf) { status =3D -ENOMEM; goto error; @@ -412,13 +412,13 @@ hwicap_read(struct file *file, char __user *buf, size= _t count, loff_t *ppos) =20 /* If we didn't read correctly, then bail out. */ if (status) { - free_page((unsigned long)kbuf); + kfree(kbuf); goto error; } =20 /* If we fail to return the data to the user, then bail out. */ if (copy_to_user(buf, kbuf, bytes_to_read)) { - free_page((unsigned long)kbuf); + kfree(kbuf); status =3D -EFAULT; goto error; } @@ -426,7 +426,7 @@ hwicap_read(struct file *file, char __user *buf, size_t= count, loff_t *ppos) kbuf, bytes_remaining); drvdata->read_buffer_in_use =3D bytes_remaining; - free_page((unsigned long)kbuf); + kfree(kbuf); } status =3D bytes_to_read; error: @@ -457,7 +457,7 @@ hwicap_write(struct file *file, const char __user *buf, goto error; } =20 - kbuf =3D (u32 *) __get_free_page(GFP_KERNEL); + kbuf =3D kmalloc(PAGE_SIZE, GFP_KERNEL); if (!kbuf) { status =3D -ENOMEM; goto error; @@ -479,13 +479,13 @@ hwicap_write(struct file *file, const char __user *bu= f, (((char *)kbuf) + drvdata->write_buffer_in_use), buf + written, len - (drvdata->write_buffer_in_use))) { - free_page((unsigned long)kbuf); + kfree(kbuf); status =3D -EFAULT; goto error; } } else { if (copy_from_user(kbuf, buf + written, len)) { - free_page((unsigned long)kbuf); + kfree(kbuf); status =3D -EFAULT; goto error; } @@ -495,7 +495,7 @@ hwicap_write(struct file *file, const char __user *buf, kbuf, len >> 2); =20 if (status) { - free_page((unsigned long)kbuf); + kfree(kbuf); status =3D -EFAULT; goto error; } @@ -516,7 +516,7 @@ hwicap_write(struct file *file, const char __user *buf, } } =20 - free_page((unsigned long)kbuf); + kfree(kbuf); status =3D written; error: mutex_unlock(&drvdata->sem); --=20 2.53.0 From nobody Sat Sep 26 23:18:34 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D538A38D for ; Sun, 30 Aug 2026 07:48:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788076095; cv=none; b=QZd6zQOyAfXD2c4u2VG1RS7vOd8RPA2IEQwwPpBJJqS4Zkp1S05OJJ6ZnCQhJP/1y1nhxLH7D5tQiR6wzlxu5F+n583W1zR9NANxqpWqSKr/ciPgqofpSrk5sdkU47iP6wuSuU2QIgPdlbROYJfA6sInA/xoGXxp3voFE0m1Flk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788076095; c=relaxed/simple; bh=xeKC46JA18zF+XZGGwo7YQ6FJiuDoI5c95XVvRXSHms=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=g6tqny2PwnHoGCLcjazJISAa3vrW/uWU9FaMGhe89kZZ53qUOZfkJvMdzu3DT0Ow/wh4iMl5fHK60Icnabelm4koV2kI46xL+lRVTH2OOIiOP6WWWDFwKTQpRMczLsxxkWodwLdB57cRhXhf/0JIy3ymcXBruJVtnf2LcnIkG5w= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=MITK9vI0; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="MITK9vI0" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7F1FF1F00A3D; Sun, 30 Aug 2026 07:48:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1788076092; bh=38jl+dsC2EM5o3wlTYxKA9vi8q2Wl79pFO6QzTnvIhE=; h=From:Date:Subject:References:In-Reply-To:To:Cc; b=MITK9vI0TqCwtGzG/5NMmeWpLrvyxDEIRP5gcuykrnjJ8pC3e+zwNDgzgR7zvRtLU KIzQKgJMT9sNr5suPtvvhbWU/cROpvKy18evTNfnEXuj1IZyDAqWfI4lgUkIp0DZha ciw9wYDeDuB2aHMYJUyfKdodFjmUGsXMvoQQ6UFn1UIGvnuSh0429/xcIJLYDiSMeE VlLLt/omlbjjYeDJc6JWI8dSpj7U6b/541bhnYGQGVYvMSzU6VT7VvnrjrNKct2d+m /GEswHY8ZS366BC6EBjVsqmNvbQ0/G81R4uGCcBP0y0kVpcd9ISRxxu4KKOgC/ZbP4 aLDP1Kl/ay2AQ== From: "Mike Rapoport (Microsoft)" Date: Sun, 30 Aug 2026 10:47:59 +0300 Subject: [PATCH 2/4] char: xillybus: replace __get_free_pages() with kmalloc() Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260830-char-misc-v1-2-05e2ce44f291@kernel.org> References: <20260830-char-misc-v1-0-05e2ce44f291@kernel.org> In-Reply-To: <20260830-char-misc-v1-0-05e2ce44f291@kernel.org> To: Arnd Bergmann , Brad Warrum , Eli Billauer , Greg Kroah-Hartman , Michal Simek , Ritu Agarwal Cc: Andrew Morton , David Hildenbrand , Matthew Wilcox , Mike Rapoport , Vlastimil Babka , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, linuxppc-dev@lists.ozlabs.org X-Mailer: b4 0.17-dev fifo_init() allocates the buffers backing the software FIFO and endpoint_alloc() allocates the transfer buffers of a USB endpoint. These buffers can be allocated with kmalloc() as there's nothing special about them 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. Since kmalloc() does not need the allocation order, ask it for the buffer sizes the driver already tracks and drop the now unused order fields. For a FIFO smaller than a page this also stops rounding the allocation up to PAGE_SIZE. Replace use of __get_free_pages() with kmalloc() and free_pages() with kfree(). Link: https://lore.kernel.org/all/635405e4-9423-4a25-a6e7-e03c8ea0bcbe@redh= at.com Assisted-by: copilot:claude-opus Signed-off-by: Mike Rapoport (Microsoft) --- drivers/char/xillybus/xillyusb.c | 25 +++++++------------------ 1 file changed, 7 insertions(+), 18 deletions(-) diff --git a/drivers/char/xillybus/xillyusb.c b/drivers/char/xillybus/xilly= usb.c index 34e7ad3bcab3..193e2a5b599e 100644 --- a/drivers/char/xillybus/xillyusb.c +++ b/drivers/char/xillybus/xillyusb.c @@ -71,7 +71,6 @@ struct xillyfifo { unsigned int bufsize; /* In bytes, always a power of 2 */ unsigned int bufnum; unsigned int size; /* Lazy: Equals bufsize * bufnum */ - unsigned int buf_order; =20 int fill; /* Number of bytes in the FIFO */ spinlock_t lock; @@ -95,7 +94,6 @@ struct xillyusb_endpoint { struct list_head filled_buffers; spinlock_t buffers_lock; /* protect these two lists */ =20 - unsigned int order; unsigned int buffer_size; =20 unsigned int fill_mask; @@ -370,7 +368,6 @@ static int fifo_init(struct xillyfifo *fifo, unsigned int log2_size) { unsigned int log2_bufnum; - unsigned int buf_order; int i; =20 unsigned int log2_fifo_buf_size; @@ -380,18 +377,14 @@ static int fifo_init(struct xillyfifo *fifo, =20 if (log2_size > log2_fifo_buf_size) { log2_bufnum =3D log2_size - log2_fifo_buf_size; - buf_order =3D fifo_buf_order; fifo->bufsize =3D 1 << log2_fifo_buf_size; } else { log2_bufnum =3D 0; - buf_order =3D (log2_size > PAGE_SHIFT) ? - log2_size - PAGE_SHIFT : 0; fifo->bufsize =3D 1 << log2_size; } =20 fifo->bufnum =3D 1 << log2_bufnum; fifo->size =3D fifo->bufnum * fifo->bufsize; - fifo->buf_order =3D buf_order; =20 fifo->mem =3D kmalloc_array(fifo->bufnum, sizeof(void *), GFP_KERNEL); =20 @@ -399,8 +392,7 @@ static int fifo_init(struct xillyfifo *fifo, return -ENOMEM; =20 for (i =3D 0; i < fifo->bufnum; i++) { - fifo->mem[i] =3D (void *) - __get_free_pages(GFP_KERNEL, buf_order); + fifo->mem[i] =3D kmalloc(fifo->bufsize, GFP_KERNEL); =20 if (!fifo->mem[i]) goto memfail; @@ -417,7 +409,7 @@ static int fifo_init(struct xillyfifo *fifo, =20 memfail: for (i--; i >=3D 0; i--) - free_pages((unsigned long)fifo->mem[i], buf_order); + kfree(fifo->mem[i]); =20 kfree(fifo->mem); fifo->mem =3D NULL; @@ -438,7 +430,7 @@ static void fifo_mem_release(struct xillyfifo *fifo) return; =20 for (i =3D 0; i < fifo->bufnum; i++) - free_pages((unsigned long)fifo->mem[i], fifo->buf_order); + kfree(fifo->mem[i]); =20 kfree(fifo->mem); } @@ -477,7 +469,7 @@ static void endpoint_dealloc(struct xillyusb_endpoint *= ep) struct xillybuffer *xb =3D list_entry(this, struct xillybuffer, entry); =20 - free_pages((unsigned long)xb->buf, ep->order); + kfree(xb->buf); kfree(xb); } =20 @@ -509,8 +501,7 @@ static struct xillyusb_endpoint init_usb_anchor(&ep->anchor); INIT_WORK(&ep->workitem, work); =20 - ep->order =3D order; - ep->buffer_size =3D 1 << (PAGE_SHIFT + order); + ep->buffer_size =3D 1 << (PAGE_SHIFT + order); ep->outstanding_urbs =3D 0; ep->drained =3D true; ep->wake_on_drain =3D false; @@ -520,7 +511,6 @@ static struct xillyusb_endpoint =20 for (i =3D 0; i < bufnum; i++) { struct xillybuffer *xb; - unsigned long addr; =20 xb =3D kzalloc_obj(*xb); =20 @@ -529,15 +519,14 @@ static struct xillyusb_endpoint return NULL; } =20 - addr =3D __get_free_pages(GFP_KERNEL, order); + xb->buf =3D kmalloc(ep->buffer_size, GFP_KERNEL); =20 - if (!addr) { + if (!xb->buf) { kfree(xb); endpoint_dealloc(ep); return NULL; } =20 - xb->buf =3D (void *)addr; xb->ep =3D ep; list_add_tail(&xb->entry, &ep->buffers); } --=20 2.53.0 From nobody Sat Sep 26 23:18:34 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8AFAC1F8755 for ; Sun, 30 Aug 2026 07:48:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788076098; cv=none; b=kyu9sV1SQK9JlD2m62EZlQxQG8mSUD1+9LNxTx95Q9+C5tLMNqS+vKVG9k9Uh8TkCfi8rPkVO44Ok56Xkk/UywgwpMBa0WJeO4E7nLA+H2RXB20tUvQpocj5x3cb54CVMTnTBUPmJWk37Ukm7FHyQxX4PXmhCanWzh9ve9xMJIM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788076098; c=relaxed/simple; bh=gZdA2234LT7avgLTCBppkWFXFTaiu7u/S8+j8oYkCxo=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=q+T3l6XNT9j/ZIOJACkCruYYGz8x0i0KcToMTTIc2UDtvqGU0LHxwGpqfXcSREVj6QH1pE6MJ3R8E/pfJJkhud5hVriCvU+VkHUxG125gP2YEx4qJrPhVdoM1bW+GzcDaxw4NE4ZQ92aigK/pRiQuYQSXpdHwH7FLQf+MyCZf+M= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Zuz9PyXX; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="Zuz9PyXX" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6FB531F00ACA; Sun, 30 Aug 2026 07:48:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1788076096; bh=ZDX3fFvUV30DfDlbIstSg54b9CSxecAVNcamfzhjDpc=; h=From:Date:Subject:References:In-Reply-To:To:Cc; b=Zuz9PyXXns1bfaGYR4gnsnrxBWaqJ2cC2WXfTQgmLJc4cO8fXpb7QJjDQGAxLBweW njwG435meYvdRMmFjpASihIDRb48QGdry5/qkaq2Bpim1xqKDzu8ooUUuChsnpepSP vwwc+zKhQKjIpM6/A6egaO7hrri8bIIpI25tyjU+LNBYikCYM/LcMQ8l5NyZLdhcU9 vdGjSE/yZUQxVqKSKjyWrw7g1+SUglzOKT/WSg7/xZtlZTiuOvVQhG77nEky66RL01 NO0eHmrDCvn816QISofFodN4Czd051W+EhaiJHQdBF7SgUCHsDXasr9K2WYziDqI5+ JsK2PWt2PH0Tw== From: "Mike Rapoport (Microsoft)" Date: Sun, 30 Aug 2026 10:48:00 +0300 Subject: [PATCH 3/4] misc: ibmvmc: replace get_zeroed_page() with kzalloc() Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260830-char-misc-v1-3-05e2ce44f291@kernel.org> References: <20260830-char-misc-v1-0-05e2ce44f291@kernel.org> In-Reply-To: <20260830-char-misc-v1-0-05e2ce44f291@kernel.org> To: Arnd Bergmann , Brad Warrum , Eli Billauer , Greg Kroah-Hartman , Michal Simek , Ritu Agarwal Cc: Andrew Morton , David Hildenbrand , Matthew Wilcox , Mike Rapoport , Vlastimil Babka , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, linuxppc-dev@lists.ozlabs.org X-Mailer: b4 0.17-dev ibmvmc_init_crq_queue() allocates the CRQ message queue that is shared with the hypervisor. The queue is mapped for DMA and registered with the hypervisor by its DMA address. 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@redh= at.com Assisted-by: copilot:claude-opus Signed-off-by: Mike Rapoport (Microsoft) --- drivers/misc/ibmvmc.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/misc/ibmvmc.c b/drivers/misc/ibmvmc.c index da82b1edb7c9..7d503ebd9f3c 100644 --- a/drivers/misc/ibmvmc.c +++ b/drivers/misc/ibmvmc.c @@ -154,7 +154,7 @@ static void ibmvmc_release_crq_queue(struct crq_server_= adapter *adapter) dma_unmap_single(adapter->dev, queue->msg_token, queue->size * sizeof(*queue->msgs), DMA_BIDIRECTIONAL); - free_page((unsigned long)queue->msgs); + kfree(queue->msgs); } =20 /** @@ -2130,7 +2130,7 @@ static int ibmvmc_init_crq_queue(struct crq_server_ad= apter *adapter) int rc =3D 0; int retrc =3D 0; =20 - queue->msgs =3D (struct ibmvmc_crq_msg *)get_zeroed_page(GFP_KERNEL); + queue->msgs =3D kzalloc(PAGE_SIZE, GFP_KERNEL); =20 if (!queue->msgs) goto malloc_failed; @@ -2192,7 +2192,7 @@ static int ibmvmc_init_crq_queue(struct crq_server_ad= apter *adapter) queue->msg_token, queue->size * sizeof(*queue->msgs), DMA_BIDIRECTIONAL); map_failed: - free_page((unsigned long)queue->msgs); + kfree(queue->msgs); malloc_failed: return -ENOMEM; } --=20 2.53.0 From nobody Sat Sep 26 23:18:34 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 438482DF126 for ; Sun, 30 Aug 2026 07:48:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788076102; cv=none; b=cJOx1tqnRXt2z9a1Y46ifGsn45z4XK6YIK9/vQMHykyxiHkQv2qPaOcAFeWuabFVE6SHdUTVj9quPO6UB3eYxOP0Y7pSpyuMSjzp8tRiWVV/OUp1KJp0ZlJyCWqMsz5Ow5Dl9ayOPr3TTTDL3JX/tq5f5S9U73BFRCSD9rNz/HA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788076102; c=relaxed/simple; bh=n+5ocaPGXB4h/fEG7Ow84+igxwd3GP3acqNKMVgGa5s=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=HUpv1TEft5dz7l7l92ZdC061K+C/ZjCZ+iu48NZ9/aBMpjaTbdJyxjT4MQUiJf+MySqejAwdN4CWcATnbyyrPi9MGTvFMTXBLDs3gS2TVEXy9ubeuO2aKmuWIzPDpMUlLhn92wIpNeGaIxrJJyuzBDlPOqkWvPUFmkqB67nH7Q4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=j4ktx4jy; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="j4ktx4jy" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5FE301F000E9; Sun, 30 Aug 2026 07:48:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1788076100; bh=XPiSY9Bg2IUmtzWz3D0CJ/RjIxKOrrK01Vto+HJVySQ=; h=From:Date:Subject:References:In-Reply-To:To:Cc; b=j4ktx4jyXz/KrmL0BMXIAcnNMVGRcpncozoVazBsVEq0DQ1QMoznmPt00il0SqMro arr9cHkcyoymqcJ7BKnbvNLt/5eB9ELfo9e1chMcnXFryp65iza5Vr36r/p7nGHSUd E1W/jtNNZ/nDz3QsyrEGQkBzP3ex3xlnQeNx4MoAQ+bVpj1m+WnjY8aeTQ4VwF705C b/zq9GLiTWwMg+cW5bKsBjq409aTTR2X0/KHXY2j/rMvJ1g9dKJbnJtfzGB1f+77c2 PMBlzPeOA/s/3CQAtDVgX9FJpYyLHYQqzq5DVfe2ALOw7yBY7XaFnzqkmYro7l04Gv kWPhAqASy764g== From: "Mike Rapoport (Microsoft)" Date: Sun, 30 Aug 2026 10:48:01 +0300 Subject: [PATCH 4/4] platform: goldfish: pipe: replace __get_free_page() with kmalloc() Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260830-char-misc-v1-4-05e2ce44f291@kernel.org> References: <20260830-char-misc-v1-0-05e2ce44f291@kernel.org> In-Reply-To: <20260830-char-misc-v1-0-05e2ce44f291@kernel.org> To: Arnd Bergmann , Brad Warrum , Eli Billauer , Greg Kroah-Hartman , Michal Simek , Ritu Agarwal Cc: Andrew Morton , David Hildenbrand , Matthew Wilcox , Mike Rapoport , Vlastimil Babka , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, linuxppc-dev@lists.ozlabs.org X-Mailer: b4 0.17-dev goldfish_pipe_open() allocates the per-pipe command buffer and goldfish_pipe_device_init() allocates the buffers the device shares with the host. Both are passed to the host as physical addresses and must be physically contiguous, which kmalloc() guarantees. These buffers can be allocated with kmalloc() as there's nothing special about them 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. While on it, size both allocations after the structures they hold instead of always taking a full page. Replace use of __get_free_page() with kmalloc() and free_page() with kfree(). Link: https://lore.kernel.org/all/635405e4-9423-4a25-a6e7-e03c8ea0bcbe@redh= at.com Assisted-by: copilot:claude-opus Signed-off-by: Mike Rapoport (Microsoft) --- drivers/platform/goldfish/goldfish_pipe.c | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/drivers/platform/goldfish/goldfish_pipe.c b/drivers/platform/g= oldfish/goldfish_pipe.c index fa241ca8feb0..3f34db896ece 100644 --- a/drivers/platform/goldfish/goldfish_pipe.c +++ b/drivers/platform/goldfish/goldfish_pipe.c @@ -708,12 +708,11 @@ static int goldfish_pipe_open(struct inode *inode, st= ruct file *file) init_waitqueue_head(&pipe->wake_queue); =20 /* - * Command buffer needs to be allocated on its own page to make sure - * it is physically contiguous in host's address space. + * The command buffer is passed to the host as a physical address, so + * it must be physically contiguous, which kmalloc() guarantees. */ BUILD_BUG_ON(sizeof(struct goldfish_pipe_command) > PAGE_SIZE); - pipe->command_buffer =3D - (struct goldfish_pipe_command *)__get_free_page(GFP_KERNEL); + pipe->command_buffer =3D kmalloc_obj(*pipe->command_buffer); if (!pipe->command_buffer) { status =3D -ENOMEM; goto err_pipe; @@ -749,7 +748,7 @@ static int goldfish_pipe_open(struct inode *inode, stru= ct file *file) dev->pipes[id] =3D NULL; err_id_locked: spin_unlock_irqrestore(&dev->lock, flags); - free_page((unsigned long)pipe->command_buffer); + kfree(pipe->command_buffer); err_pipe: kfree(pipe); return status; @@ -770,7 +769,7 @@ static int goldfish_pipe_release(struct inode *inode, s= truct file *filp) spin_unlock_irqrestore(&dev->lock, flags); =20 filp->private_data =3D NULL; - free_page((unsigned long)pipe->command_buffer); + kfree(pipe->command_buffer); kfree(pipe); return 0; } @@ -833,13 +832,12 @@ static int goldfish_pipe_device_init(struct platform_= device *pdev, =20 /* * We're going to pass two buffers, open_command_params and - * signalled_pipe_buffers, to the host. This means each of those buffers - * needs to be contained in a single physical page. The easiest choice - * is to just allocate a page and place the buffers in it. + * signalled_pipe_buffers, to the host as physical addresses. This means + * each of those buffers needs to be physically contiguous, which + * kmalloc() guarantees. */ BUILD_BUG_ON(sizeof(struct goldfish_pipe_dev_buffers) > PAGE_SIZE); - dev->buffers =3D (struct goldfish_pipe_dev_buffers *) - __get_free_page(GFP_KERNEL); + dev->buffers =3D kmalloc_obj(*dev->buffers); if (!dev->buffers) { kfree(dev->pipes); misc_deregister(&dev->miscdev); @@ -867,7 +865,7 @@ static void goldfish_pipe_device_deinit(struct platform= _device *pdev, { misc_deregister(&dev->miscdev); kfree(dev->pipes); - free_page((unsigned long)dev->buffers); + kfree(dev->buffers); } =20 static int goldfish_pipe_probe(struct platform_device *pdev) --=20 2.53.0