public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
From: Richard Weinberger <richard@nod.at>
To: Christoph Hellwig <hch@infradead.org>
Cc: Kuan-Wei Chiu <visitorckw@gmail.com>,
	 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: Wed, 18 Mar 2026 11:07:51 +0100 (CET)	[thread overview]
Message-ID: <566555015.53186.1773828471518.JavaMail.zimbra@nod.at> (raw)
In-Reply-To: <abo-vgtDeFNRjG5G@infradead.org>

----- 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.

Thanks,
//richard

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

  reply	other threads:[~2026-03-18 10:08 UTC|newest]

Thread overview: 4+ 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-18  5:57 ` Christoph Hellwig
2026-03-18 10:07   ` Richard Weinberger [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=566555015.53186.1773828471518.JavaMail.zimbra@nod.at \
    --to=richard@nod.at \
    --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=visitorckw@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