From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from lithops.sigma-star.at (mailout.nod.at [116.203.167.152]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A7050291C10 for ; Wed, 25 Mar 2026 07:26:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=116.203.167.152 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774423580; cv=none; b=E7Y2R0e/iqnC8JRdQgXW+s6drdEv94YEAIxfBP63crr+bX2Oxohv/j+PHTHPk0p43OlvGXfDBnjEkK7y641W7llmmDsPjmZDZt9zTyE2tQF0HemcqZupA7IULf8WcOL8AEy0Vc2G/3L7CyXpcoGQjuiOkpjDOpNNKJPv8KeWU4k= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774423580; c=relaxed/simple; bh=slyeoFk+Xq7BAiayxiDe771RK4La6SkIEIIz6InkXvo=; h=Date:From:To:Cc:Message-ID:In-Reply-To:References:Subject: MIME-Version:Content-Type; b=fkf40Nb8FysHBc52rpPxm1wVYof42tY0ZMt93fflB4y6zdKs1WdU2Z3G3gARR3gUseMZs1KWor4PJ2sOH0E10B26lWEEWgU9u1a6n6FXPSeMGsSn8/acVws5lPfNLiaGMfffKNKQsLyxjWv0cvc9su3d5SJTIngZEu4QzYs4H0I= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=nod.at; spf=fail smtp.mailfrom=nod.at; arc=none smtp.client-ip=116.203.167.152 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=nod.at Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=nod.at Received: from localhost (localhost [127.0.0.1]) by lithops.sigma-star.at (Postfix) with ESMTP id EAB1A298580; Wed, 25 Mar 2026 08:18:20 +0100 (CET) Received: from lithops.sigma-star.at ([127.0.0.1]) by localhost (lithops.sigma-star.at [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id xcqmmnRjpV9C; Wed, 25 Mar 2026 08:18:17 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by lithops.sigma-star.at (Postfix) with ESMTP id A0BAB2918DC; Wed, 25 Mar 2026 08:18:17 +0100 (CET) Received: from lithops.sigma-star.at ([127.0.0.1]) by localhost (lithops.sigma-star.at [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id MffBK7rrhauA; Wed, 25 Mar 2026 08:18:17 +0100 (CET) Received: from lithops.sigma-star.at (lithops.sigma-star.at [195.201.40.130]) by lithops.sigma-star.at (Postfix) with ESMTP id 5A793298580; Wed, 25 Mar 2026 08:18:17 +0100 (CET) Date: Wed, 25 Mar 2026 08:18:17 +0100 (CET) From: Richard Weinberger To: Kuan-Wei Chiu Cc: Andrew Morton , chengzhihao1 , Christoph Hellwig , jserv , eleanor15x , marscheng , linux-mtd , linux-kernel Message-ID: <2146783189.85721.1774423097193.JavaMail.zimbra@nod.at> In-Reply-To: <20260320180938.1827148-2-visitorckw@gmail.com> References: <20260320180938.1827148-1-visitorckw@gmail.com> <20260320180938.1827148-2-visitorckw@gmail.com> Subject: Re: [PATCH v3 1/2] ubifs: Remove unnecessary cond_resched() from list_sort() compare Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Mailer: Zimbra 8.8.12_GA_3807 (ZimbraWebClient - FF148 (Linux)/8.8.12_GA_3809) Thread-Topic: ubifs: Remove unnecessary cond_resched() from list_sort() compare Thread-Index: dE1j6UB4aWpygkswihoGaLXrLVYI+g== ----- Urspr=C3=BCngliche Mail ----- > Von: "Kuan-Wei Chiu" > An: "richard" , "Andrew Morton" > CC: "chengzhihao1" , "Christoph Hellwig" , "jserv" , > "eleanor15x" , "marscheng" , = "linux-mtd" , > "linux-kernel" , "Kuan-Wei Chiu" > Gesendet: Freitag, 20. M=C3=A4rz 2026 19:09:37 > Betreff: [PATCH v3 1/2] ubifs: Remove unnecessary cond_resched() from lis= t_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. >=20 > 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. >=20 > 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. >=20 > Signed-off-by: Kuan-Wei Chiu Acked-by: Richard Weinberger Thanks, //richard