From: Matthew Wilcox <willy@infradead.org>
To: laishangzhen <laishangzhen@163.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] mm: Removing the card during write
Date: Mon, 28 Jul 2025 15:42:09 +0100 [thread overview]
Message-ID: <aIeMQfVNucc3_RRa@casper.infradead.org> (raw)
In-Reply-To: <20250728141306.23451-1-laishangzhen@163.com>
On Mon, Jul 28, 2025 at 07:13:06AM -0700, laishangzhen wrote:
> When formatting an SD card to ext4 using mkfs.ext4,
> if the card is ejected during the process,
> the formatting process blocks at
> balance_dirty_pages_ratelimited.
You're fixing this in the wrong place; it should be in mm/page-writeback.c
somewhere.
But it really needs a more thorough analysis than this. To date we do
not handle removable media well. I wrote up a proposal in 2018 here:
http://www.wil.cx/~willy/banbury.html but I haven't done any work
towards it.
You're proposing an entirely different approach which is to just,
well, kill applications. This leaves pages in the page cache which are
effectively leaked. If we continue on this path, we'd also want a way to
release all the pages in the page cache associated with this block device.
And that's a harder problem than you might think.
prev parent reply other threads:[~2025-07-28 14:42 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-28 14:13 [PATCH] mm: Removing the card during write laishangzhen
2025-07-28 14:42 ` Matthew Wilcox [this message]
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=aIeMQfVNucc3_RRa@casper.infradead.org \
--to=willy@infradead.org \
--cc=akpm@linux-foundation.org \
--cc=laishangzhen@163.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/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;
as well as URLs for NNTP newsgroup(s).