mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] ublk: reduce stack usage in __ublk_shmem_remove_ranges
@ 2026-09-15 20:00 Arnd Bergmann
  2026-09-16  0:37 ` Ming Lei
  0 siblings, 1 reply; 2+ messages in thread
From: Arnd Bergmann @ 2026-09-15 20:00 UTC (permalink / raw)
  To: Ming Lei, Jens Axboe
  Cc: Arnd Bergmann, Caleb Sander Mateos, linux-block, linux-kernel

From: Arnd Bergmann <arnd@arndb.de>

The array in __ublk_shmem_remove_ranges() is one kilobyte long,
which is really too much for an on-stack allocation, as can be
seen with a frame warning limit of 1.25kb that otherwise produces
a clean build on my test system:

drivers/block/ublk_drv.c: In function '__ublk_shmem_remove_ranges':
drivers/block/ublk_drv.c:5573:1: error: the frame size of 1392 bytes is larger than 1280 bytes [-Werror=frame-larger-than=]

Maybe half the size is good enough here, so try 32 entries.
If 64 entries are really required, the array could be dynamically
allocated, but that would risk an allocation failure.

Fixes: 309e02dccf64 ("ublk: avoid unpinning pages under maple tree spinlock")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
I have really no idea if the 64 number was significant or just chosen
to fit within usual stack frames.
---
 drivers/block/ublk_drv.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/block/ublk_drv.c b/drivers/block/ublk_drv.c
index 66eb55e7162e..6fe85aba32ce 100644
--- a/drivers/block/ublk_drv.c
+++ b/drivers/block/ublk_drv.c
@@ -5531,7 +5531,7 @@ static void ublk_unpin_range_pages(unsigned long base_pfn,
  *
  * Returns true if the tree walk completed, false if more ranges remain.
  */
-#define UBLK_REMOVE_BATCH	64
+#define UBLK_REMOVE_BATCH	32
 
 struct ublk_unpin_range {
 	unsigned long base_pfn;
-- 
2.53.0


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-09-16  0:37 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-15 20:00 [PATCH] ublk: reduce stack usage in __ublk_shmem_remove_ranges Arnd Bergmann
2026-09-16  0:37 ` Ming Lei

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®