From: Kuan-Wei Chiu <visitorckw@gmail.com>
To: Kent Overstreet <kent.overstreet@linux.dev>
Cc: linux-bcachefs@vger.kernel.org, linux-kernel@vger.kernel.org,
Andrew Morton <akpm@linux-foundation.org>
Subject: Re: [PATCH] lib/sort.c: Add _nonatomic() variants with cond_resched()
Date: Wed, 26 Mar 2025 23:54:15 +0800 [thread overview]
Message-ID: <Z+QjJxcnAkeGIbCT@visitorckw-System-Product-Name> (raw)
In-Reply-To: <20250326152606.2594920-1-kent.overstreet@linux.dev>
On Wed, Mar 26, 2025 at 11:26:06AM -0400, Kent Overstreet wrote:
> Andrew - if you're ok with this patch I'd like to get it in soon as a
> bugfix, I've been getting quite a few reports on this one.
>
> I don't much care for the naming though, thoughts there?
>
> -- >8 --
>
> bcachefs calls sort() during recovery to sort all keys it found in the
> journal, and this may be very large - gigabytes on large machines.
>
> This has been causing "task blocked" warnings, so needs a
> cond_resched().
>
> Cc: Kuan-Wei Chiu <visitorckw@gmail.com>
> Cc: Andrew Morton <akpm@linux-foundation.org>
> Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
> ---
> include/linux/sort.h | 11 +++++++++++
> lib/sort.c | 46 +++++++++++++++++++++++++++++++++++++++-----
> 2 files changed, 52 insertions(+), 5 deletions(-)
>
I don't have strong opinions on this, but I recall that UBIFS had a
similar issue with list_sort(), and they addressed it by calling
cond_resched() within the compare function. Would that approach be
simpler and more appropriate than introducing a new API in the library
code?
Regards,
Kuan-Wei
next prev parent reply other threads:[~2025-03-26 15:54 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-26 15:26 [PATCH] lib/sort.c: Add _nonatomic() variants with cond_resched() Kent Overstreet
2025-03-26 15:54 ` Kuan-Wei Chiu [this message]
2025-03-26 16:09 ` Kent Overstreet
2025-03-27 18:09 ` Andrew Morton
2025-03-27 19:47 ` Kent Overstreet
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=Z+QjJxcnAkeGIbCT@visitorckw-System-Product-Name \
--to=visitorckw@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=kent.overstreet@linux.dev \
--cc=linux-bcachefs@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