From: Zhihao Cheng <chengzhihao1@huawei.com>
To: Yelin Fei <yelinfei66@gmail.com>, <linux-mtd@lists.infradead.org>
Cc: <richard@nod.at>, <miquel.raynal@bootlin.com>, <vigneshr@ti.com>,
<linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 2/2] mtd: ubi: use GFP_NOIO for lock tree entry allocation
Date: Thu, 15 Oct 2026 19:03:47 +0800 [thread overview]
Message-ID: <f89c80cb-d879-ede2-9459-1778ff2f71c2@huawei.com> (raw)
In-Reply-To: <8b4e0b970271095df8321b1662aa464c5b9002dc.1792046946.git.yelinfei@ruijie.com.cn>
在 2026/10/15 15:33, Yelin Fei 写道:
> From: Ye Linfei <yelinfei@ruijie.com.cn>
>
> The per-LEB lock tree entry can be allocated while UBI is executing on
> behalf of a synchronous block-layer consumer (ubiblock), where issuing
> further block I/O from direct reclaim would deadlock; see the
> preceding commit "mtd: ubi: block: forbid direct reclaim I/O during
> synchronous read" for the full analysis.
>
> Make the allocation self-contained: GFP_NOIO restricts direct reclaim
> to dropping clean page cache and shrinking slabs, page (swap) reclaim
> is left to kswapd, and the worst case is -ENOMEM, which callers
> already propagate as an ordinary recoverable I/O error.
>
> memalloc_noio_save()/memalloc_noio_restore() in ubiblock_read()
> already enforce this for the whole read scope; keeping the allocation
> here self-contained as well means the safety property does not depend
> on every future caller remembering to set up that scope.
The ltree_add_entry() has many callers that not need GFP_NOIO, I think
'mtd: ubi: block: forbid direct reclaim I/O during
> synchronous read' is enough.
>
> Signed-off-by: Ye Linfei <yelinfei@ruijie.com.cn>
> ---
> drivers/mtd/ubi/eba.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/mtd/ubi/eba.c b/drivers/mtd/ubi/eba.c
> index f0c549e62c55..8fe68e7fff58 100644
> --- a/drivers/mtd/ubi/eba.c
> +++ b/drivers/mtd/ubi/eba.c
> @@ -247,7 +247,7 @@ static struct ubi_ltree_entry *ltree_add_entry(struct ubi_device *ubi,
> {
> struct ubi_ltree_entry *le, *le1, *le_free;
>
> - le = kmalloc_obj(struct ubi_ltree_entry, GFP_NOFS);
> + le = kmalloc_obj(struct ubi_ltree_entry, GFP_NOIO); /* see ubiblock_read() */
> if (!le)
> return ERR_PTR(-ENOMEM);
>
>
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
next prev parent reply other threads:[~2026-10-15 11:04 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-15 7:33 [PATCH 0/2] mtd: ubi: fix direct reclaim deadlock with synchronous block devices Yelin Fei
2026-10-15 7:33 ` [PATCH 1/2] mtd: ubi: block: forbid direct reclaim I/O during synchronous read Yelin Fei
2026-10-15 7:49 ` sashiko-bot
2026-10-15 9:30 ` Zhihao Cheng
2026-10-15 7:33 ` [PATCH 2/2] mtd: ubi: use GFP_NOIO for lock tree entry allocation Yelin Fei
2026-10-15 11:03 ` Zhihao Cheng [this message]
2026-10-15 11:56 ` Ye Linfei
2026-10-15 12:01 ` [PATCH v2] mtd: ubi: block: forbid direct reclaim I/O during synchronous read Ye Linfei
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=f89c80cb-d879-ede2-9459-1778ff2f71c2@huawei.com \
--to=chengzhihao1@huawei.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mtd@lists.infradead.org \
--cc=miquel.raynal@bootlin.com \
--cc=richard@nod.at \
--cc=vigneshr@ti.com \
--cc=yelinfei66@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