From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pl1-f175.google.com (mail-pl1-f175.google.com [209.85.214.175]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0983729B8CF for ; Thu, 19 Mar 2026 05:37:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.175 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773898643; cv=none; b=Vbmrv5WK7NaDzlX7/5rA5PA+2rSsbsdUYgBtLvrSRnRoPHHsChNtV8TxGMrWw/IjHNwsgCtUqa6ANraAf8OqFvWIKezno3Y0eNHmL2CvT2bK+E1PK8EDRYj65TfjWTBQAbQ5rOpU/pnTpGFpIaX0bCUmB0TeuYM9UORm3Zj1r9E= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773898643; c=relaxed/simple; bh=9sUEGQhz2AQzSjPCQxgZmGBOBAtgTnAff7i2J7TsMkw=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=iqkjal0gA68NiimKbkIwpB7z9tsnzw1TDz4z0zDSXb29XOWhAwoANPHdHHmIPuWepiArqzh2pKEdkookdcEiI+AfD171al7qT+8yFKpGXp0elPbHZ5/qP2jKW8l3smKK8WNbNenVVXqGAdFUlMjY2XY6pGFWAtXGh5BfT+FXTlQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=lhjET6ts; arc=none smtp.client-ip=209.85.214.175 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="lhjET6ts" Received: by mail-pl1-f175.google.com with SMTP id d9443c01a7336-2b062069f80so4179595ad.0 for ; Wed, 18 Mar 2026 22:37:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1773898641; x=1774503441; darn=vger.kernel.org; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date:from:to :cc:subject:date:message-id:reply-to; bh=60j1lBiHaNA5SIxKdMG0q5Pm6jWzJaZqQXdmPT8/wiA=; b=lhjET6tsB/74vFIDTf9d/iMLP2FOLeYux7CYvoPbMdDzsKrtnVFAFOfsu6Q6Y2YNbV cmt+l0jsf6iTsV7yfMwNgJVqWxTGr2YXPSdlw0kgnz/NzFNa9KTjuLlmEbXz2MV1YDzn v4Wv109besWklB1xIEDxu2MxLqFWvfeECjDNm1J/hxg8K3myNIZ98ojSKBfKK8UPOBP8 lzm05F6jcn0m5L9l48cEbl3OFUEVA+vnHak5dC34FshwPXQsNGV13TlV/gmx+3mrOXTG aEhUeY9n9sPWIjkgHo4ZMWCIbrhGAYVlq//NsaLHwzJeX2GoFNhtbeCMt2zTzxmyRXuR vbAA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1773898641; x=1774503441; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=60j1lBiHaNA5SIxKdMG0q5Pm6jWzJaZqQXdmPT8/wiA=; b=BBIFUT1iPjVOsTA6kygOmZy7FrkKSX7ownYHa6wvxg4Hx/SOU3y7AUwmaOn7dE8tAR dPLdtSgCZLdBjfpkr6chbUGeGvoUe4pYDCeQznnxdqL63aJvN+LN9zWkRzWTHU3fo0j3 ks9hEmw4+lm2Y8b/3SEOPoTMpGPgqKVEHiQlkyiV9kFx7Eff+/Yq8hF0yDKyU0koySIv MRklxD6m7GxlOWNm4ADRcIvjFWPa/gyiMfyhmpiJRH1PFyQgkO0y8BwXIhJLYe9bGo7m Eg2cW7LxjsCZXfK6jUWxnyGJjMfsCxQU1zS2+cmaJMs7pvxXrKdXH7crlswNY4YVNtPU 0FLQ== X-Forwarded-Encrypted: i=1; AJvYcCUNlhePJOTLGZhnFBCLsOf40XEyThIeQEjHII3QAaTPMnu+yedCZNCejV4ZUHTHK8fiITn+qqb+hvMoGAk=@vger.kernel.org X-Gm-Message-State: AOJu0Yxr4J4d5AlDYU9nIqD0omNyKnhPjc6090OpQJ47CweWnT27NFWT zC6m6gEnhS85QsG1JS4yLRoWYkU5YIwBDjdMTCKTfIhXOlKHGNOSsx2ymy6OG00Z X-Gm-Gg: ATEYQzzXu5XK03JVEpgGXh+rml2oDwV4unOLNdGhv9MOCSuTGs0G5wE0+DgYgTsk9vJ 2/lgSXCag4WgwB2fq4THV5qKg4kPySYq4UTJGjGiS9++1YWHRc9nFy8xPDfekr3WITzyeNIAdnG AHk5aIyNVj89fMOiIkRaIHcQxTv46w/OMKh13c1HPBweUtUQG5xktPA3Z4UtziDOU0WXvkna7bC MPdhyUcAi1muCgYVL0T6r9X0yq3UVrv4Y/gnUuiPVIuJwPutIJJPmLBVvf0JJBruRfERcXinTUQ 6ooXpSwA0Ob0Uh4CiMsb0zJB2ffTTCj+Z23EQPtVST1Xj16XgFJ1qDWA33kH3FZ/Kz4cAPW7MO/ JOZwZRg7fzPDlrvkq9o1LYm3aILeM+lETZ5EsyX07kyGwXy4bTUrLEuuvHtBS/fuKxZXwTKG1Zq 36WJGknHvj5tP5OGM7dXBR3rnVQ6wE64RTvGCls5chZvj6 X-Received: by 2002:a17:902:f60b:b0:2ae:a73c:f773 with SMTP id d9443c01a7336-2b06e410d50mr55600955ad.41.1773898641265; Wed, 18 Mar 2026 22:37:21 -0700 (PDT) Received: from google.com ([49.216.182.145]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2b06e60493asm45836815ad.59.2026.03.18.22.37.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Mar 2026 22:37:20 -0700 (PDT) Date: Thu, 19 Mar 2026 13:37:14 +0800 From: Kuan-Wei Chiu To: Richard Weinberger Cc: Christoph Hellwig , Andrew Morton , chengzhihao1 , jserv , eleanor15x , marscheng , linux-mtd , linux-kernel Subject: Re: [PATCH v2] lib/list_sort: introduce list_sort_nonatomic() and clean up scheduling workarounds Message-ID: References: <20260317165905.1482256-1-visitorckw@gmail.com> <566555015.53186.1773828471518.JavaMail.zimbra@nod.at> 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=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit 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" > >> 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