mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Arnd Bergmann <arnd@kernel.org>
To: Ming Lei <tom.leiming@gmail.com>, Jens Axboe <axboe@kernel.dk>
Cc: Arnd Bergmann <arnd@arndb.de>,
	Caleb Sander Mateos <csander@purestorage.com>,
	linux-block@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH] ublk: reduce stack usage in __ublk_shmem_remove_ranges
Date: Tue, 15 Sep 2026 22:00:56 +0200	[thread overview]
Message-ID: <20260915200107.3522560-1-arnd@kernel.org> (raw)

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


             reply	other threads:[~2026-09-15 20:01 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-15 20:00 Arnd Bergmann [this message]
2026-09-16  0:37 ` Ming Lei

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=20260915200107.3522560-1-arnd@kernel.org \
    --to=arnd@kernel.org \
    --cc=arnd@arndb.de \
    --cc=axboe@kernel.dk \
    --cc=csander@purestorage.com \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tom.leiming@gmail.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

all inboxes | Powered by JetHome®