From: Kuan-Wei Chiu <visitorckw@gmail.com>
To: Richard Weinberger <richard@nod.at>
Cc: Christoph Hellwig <hch@infradead.org>,
Andrew Morton <akpm@linux-foundation.org>,
chengzhihao1 <chengzhihao1@huawei.com>,
jserv <jserv@ccns.ncku.edu.tw>, eleanor15x <eleanor15x@gmail.com>,
marscheng <marscheng@google.com>,
linux-mtd <linux-mtd@lists.infradead.org>,
linux-kernel <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v2] lib/list_sort: introduce list_sort_nonatomic() and clean up scheduling workarounds
Date: Thu, 19 Mar 2026 13:37:14 +0800 [thread overview]
Message-ID: <abuLijcND3mqnUoa@google.com> (raw)
In-Reply-To: <566555015.53186.1773828471518.JavaMail.zimbra@nod.at>
On Wed, Mar 18, 2026 at 11:07:51AM +0100, Richard Weinberger wrote:
> ----- Ursprüngliche Mail -----
> > Von: "Christoph Hellwig" <hch@infradead.org>
> >> This change leaves the generic list_sort() completely free of
> >> scheduling hacks, simplifies UBIFS's callbacks, and ensures that legacy
> >> long-list sorting workloads remain safe from soft lockups on
> >> non-preemptible kernels.
> >
> > As said before we really should not add the extra nonatomic API
> > and just do the right thing, and drop the cond_resched in ubifs
> > in a prep patch.
>
> I think you are right. After inspecting UBIFS's usage of list_sort()
> I feel more confident that we can remove the calls to cond_resched()
> from the compare functions.
>
> The compare functions are rather cheap, they don't do (blocking)
> MTD io.
> In the GC case each list contains at most as many UBIFS nodes you can
> stuff into a single LEB.
> The replay case is a little different, the replay list can contain
> elements from multiple LEBs. But the UBIFS journal is limited to
> a few LEBs, so the list is likely always at most a few thousand
> elements long.
> So, we always talk about calling the compare functions a few thousand
> times, not millions times.
>
Great, thanks for verifying this.
I'll prepare a v3 to drop the cond_resched() calls from UBIFS's cmp(),
and remove the if(!++count) from list_sort().
Regards,
Kuan-Wei
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
WARNING: multiple messages have this Message-ID (diff)
From: Kuan-Wei Chiu <visitorckw@gmail.com>
To: Richard Weinberger <richard@nod.at>
Cc: Christoph Hellwig <hch@infradead.org>,
Andrew Morton <akpm@linux-foundation.org>,
chengzhihao1 <chengzhihao1@huawei.com>,
jserv <jserv@ccns.ncku.edu.tw>, eleanor15x <eleanor15x@gmail.com>,
marscheng <marscheng@google.com>,
linux-mtd <linux-mtd@lists.infradead.org>,
linux-kernel <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v2] lib/list_sort: introduce list_sort_nonatomic() and clean up scheduling workarounds
Date: Thu, 19 Mar 2026 13:37:14 +0800 [thread overview]
Message-ID: <abuLijcND3mqnUoa@google.com> (raw)
In-Reply-To: <566555015.53186.1773828471518.JavaMail.zimbra@nod.at>
On Wed, Mar 18, 2026 at 11:07:51AM +0100, Richard Weinberger wrote:
> ----- Ursprüngliche Mail -----
> > Von: "Christoph Hellwig" <hch@infradead.org>
> >> This change leaves the generic list_sort() completely free of
> >> scheduling hacks, simplifies UBIFS's callbacks, and ensures that legacy
> >> long-list sorting workloads remain safe from soft lockups on
> >> non-preemptible kernels.
> >
> > As said before we really should not add the extra nonatomic API
> > and just do the right thing, and drop the cond_resched in ubifs
> > in a prep patch.
>
> I think you are right. After inspecting UBIFS's usage of list_sort()
> I feel more confident that we can remove the calls to cond_resched()
> from the compare functions.
>
> The compare functions are rather cheap, they don't do (blocking)
> MTD io.
> In the GC case each list contains at most as many UBIFS nodes you can
> stuff into a single LEB.
> The replay case is a little different, the replay list can contain
> elements from multiple LEBs. But the UBIFS journal is limited to
> a few LEBs, so the list is likely always at most a few thousand
> elements long.
> So, we always talk about calling the compare functions a few thousand
> times, not millions times.
>
Great, thanks for verifying this.
I'll prepare a v3 to drop the cond_resched() calls from UBIFS's cmp(),
and remove the if(!++count) from list_sort().
Regards,
Kuan-Wei
next prev parent reply other threads:[~2026-03-19 5:37 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-17 16:59 [PATCH v2] lib/list_sort: introduce list_sort_nonatomic() and clean up scheduling workarounds Kuan-Wei Chiu
2026-03-17 16:59 ` Kuan-Wei Chiu
2026-03-18 5:57 ` Christoph Hellwig
2026-03-18 5:57 ` Christoph Hellwig
2026-03-18 10:07 ` Richard Weinberger
2026-03-18 10:07 ` Richard Weinberger
2026-03-19 5:37 ` Kuan-Wei Chiu [this message]
2026-03-19 5:37 ` Kuan-Wei Chiu
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=abuLijcND3mqnUoa@google.com \
--to=visitorckw@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=chengzhihao1@huawei.com \
--cc=eleanor15x@gmail.com \
--cc=hch@infradead.org \
--cc=jserv@ccns.ncku.edu.tw \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mtd@lists.infradead.org \
--cc=marscheng@google.com \
--cc=richard@nod.at \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.