From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 1E72138945C for ; Tue, 3 Feb 2026 07:00:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770102021; cv=none; b=CVLMT8hmOK/c5+6RutA31/pkC9xda96VufmixYownY6jb/0kFMgPlix/D5lbfH3bq8VNdDB3vBcQdAfa54ZyEUmv/7AH7eu2f3VBq4clJp14uNqT5qjjpLq6uh6wcb2itrwFCekhnDx+MNSN6sZXZ6iiD7D5YzaKh5OVUJ4hv0c= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770102021; c=relaxed/simple; bh=7FRhymRM7ABlhFQQhv2LKLQ4s+C7K++Ywzs0GQCFyEc=; h=Message-ID:Date:MIME-Version:Cc:Subject:To:References:From: In-Reply-To:Content-Type; b=mMO/G33QWVeh8tDZxWLvDyWbKWi2y9EfXaOWxPYk9BVMNAFTK6DJL81djOb7KQ3EjmmTmYP+MopsuGQKuivwtaS+iUWjQQOJdijvteNAZMDhnLyx6CWy/kH1vFN8ST1EMK5cSQU+jWgsV6GX8OEG6Gs1CwKH4ftSafF5lbMrk/Q= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=GwxmyvW1; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="GwxmyvW1" Received: by smtp.kernel.org (Postfix) with ESMTPSA id D24CCC116D0; Tue, 3 Feb 2026 07:00:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1770102021; bh=7FRhymRM7ABlhFQQhv2LKLQ4s+C7K++Ywzs0GQCFyEc=; h=Date:Cc:Subject:To:References:From:In-Reply-To:From; b=GwxmyvW1tcpbo/WXRXYO+f5eDWDRnDiSmuZ2+IS/aHGeKVRBef9d9nyCKVfb5xM2i gYcch6CelIa41/9imc8QrygYyN+zexNBGAsX7sCnblHu/T/Pyr8SY7/MSm/pK1ARja ZawB3xpk6XJPQbWDrwgbUEgUw3RSZdHKZKZ5gV/fyfqpgRVIsGvramFJC6Vr8TcHcz PMa1AzOqxWZCg/pPGiztH8qVJ9Epubzg4/zxKfEpjEx7O3vkh+7DSXJGOTUnZGRh4t SAASBnzJSv3gnUKye+FJ0LTbue5ewYcLNIzxYIOMFD+1NsbnNyeh6osTpFjxjSuY7B DCuaf8pH9Umvw== Message-ID: <6458f1d3-e38e-4dbf-9202-511abb6a242e@kernel.org> Date: Tue, 3 Feb 2026 15:00:11 +0800 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Cc: chao@kernel.org, jaegeuk@kernel.org, linux-f2fs-devel@lists.sourceforge.net, linux-kernel@vger.kernel.org Subject: Re: [PATCH 1/2] f2fs: fix lock priority inversion issue To: Barry Song <21cnbao@gmail.com> References: <20260130132809.59707-1-chao@kernel.org> Content-Language: en-US From: Chao Yu In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit On 1/31/2026 10:50 AM, Barry Song wrote: > On Sat, Jan 31, 2026 at 10:27 AM Chao Yu wrote: >> >> If userspace thread has held f2fs rw semaphore, due to its low priority, >> it could be runnable or preempted state for long time, during the time, >> it will block high priority thread which is trying to grab the same rw >> semaphore, e.g. cp_rwsem, io_rwsem... >> >> To fix such issue, let's detect thread's priority when it tries to grab >> f2fs_rwsem lock, if the priority is lower than a priority threshold, let's >> uplift the priority before it enters into critical region of lock, and >> restore the priority after it leaves from critical region. > > Hi Chao, > > Is this even possible if can_nice() returns false, for example due to > missing CAP_SYS_NICE? Hi Barry, I think so, the priority will be temporarily uplifted and restored in lock duration. > > Proxy execution [1] is currently under development to address general > priority inversion; hopefully, it will resolve this issue. Thanks for providing the material. Yes, there should be generic solution in cpu scheduler and lock primitive to resolve priority inversion issue. Then it will be benefit for all lock users. Not sure, it will be a little bit hard for rw semaphore, it needs to track and check all reader threads' context in priority inversion scenario. Thanks, > > [1] https://lpc.events/event/18/contributions/1887/attachments/1402/3074/LPC_%20Proxy%20Exec%20deep%20dive%20outline.pdf > > Thanks > Barry