From: Richard Weinberger <richard@nod.at>
To: Kuan-Wei Chiu <visitorckw@gmail.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
chengzhihao1 <chengzhihao1@huawei.com>,
Christoph Hellwig <hch@infradead.org>,
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 v3 1/2] ubifs: Remove unnecessary cond_resched() from list_sort() compare
Date: Wed, 25 Mar 2026 08:18:17 +0100 (CET) [thread overview]
Message-ID: <2146783189.85721.1774423097193.JavaMail.zimbra@nod.at> (raw)
In-Reply-To: <20260320180938.1827148-2-visitorckw@gmail.com>
----- Ursprüngliche Mail -----
> Von: "Kuan-Wei Chiu" <visitorckw@gmail.com>
> An: "richard" <richard@nod.at>, "Andrew Morton" <akpm@linux-foundation.org>
> CC: "chengzhihao1" <chengzhihao1@huawei.com>, "Christoph Hellwig" <hch@infradead.org>, "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>, "Kuan-Wei Chiu" <visitorckw@gmail.com>
> Gesendet: Freitag, 20. März 2026 19:09:37
> Betreff: [PATCH v3 1/2] ubifs: Remove unnecessary cond_resched() from list_sort() compare
> Historically, UBIFS embedded cond_resched() calls inside its
> list_sort() comparison callbacks (data_nodes_cmp, nondata_nodes_cmp,
> and replay_entries_cmp) to prevent soft lockups when sorting long
> lists.
>
> However, further inspection by Richard Weinberger reveals that these
> compare functions are extremely lightweight and do not perform any
> blocking MTD I/O. Furthermore, the lists being sorted are strictly
> bounded in size:
> - In the GC case, the list contains at most the number of nodes that
> fit into a single LEB.
> - In the replay case, the list spans across a few LEBs from the UBIFS
> journal, amounting to at most a few thousand elements.
>
> Since the compare functions are called a few thousand times at most,
> the overhead of frequent scheduling points is unjustified. Removing the
> cond_resched() calls simplifies the comparison logic and reduces
> unnecessary context switch checks during the sort.
>
> Signed-off-by: Kuan-Wei Chiu <visitorckw@gmail.com>
Acked-by: Richard Weinberger <richard@nod.at>
Thanks,
//richard
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
next prev parent reply other threads:[~2026-03-25 7:18 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-20 18:09 [PATCH v3 0/2] lib/list_sort: Clean up list_sort() scheduling workarounds Kuan-Wei Chiu
2026-03-20 18:09 ` [PATCH v3 1/2] ubifs: Remove unnecessary cond_resched() from list_sort() compare Kuan-Wei Chiu
2026-03-21 2:06 ` Zhihao Cheng
2026-03-25 7:18 ` Richard Weinberger [this message]
2026-03-20 18:09 ` [PATCH v3 2/2] lib/list_sort: Remove dummy cmp() calls to speed up merge_final() Kuan-Wei Chiu
2026-03-25 5:44 ` Christoph Hellwig
2026-03-21 1:21 ` [PATCH v3 0/2] lib/list_sort: Clean up list_sort() scheduling workarounds Andrew Morton
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=2146783189.85721.1774423097193.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