public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Chao Yu <chao@kernel.org>
To: Barry Song <21cnbao@gmail.com>
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
Date: Tue, 3 Feb 2026 15:00:11 +0800	[thread overview]
Message-ID: <6458f1d3-e38e-4dbf-9202-511abb6a242e@kernel.org> (raw)
In-Reply-To: <CAGsJ_4yGBt4Rt=njP=cY++DbEDAWKSyDuuXOC2pXGoJGCvJYFw@mail.gmail.com>

On 1/31/2026 10:50 AM, Barry Song wrote:
> On Sat, Jan 31, 2026 at 10:27 AM Chao Yu <chao@kernel.org> 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


  reply	other threads:[~2026-02-03  7:00 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-30 13:28 [PATCH 1/2] f2fs: fix lock priority inversion issue Chao Yu
2026-01-30 13:28 ` [PATCH 2/2] f2fs: introduce trace_f2fs_priority_update Chao Yu
2026-01-31  2:50 ` [PATCH 1/2] f2fs: fix lock priority inversion issue Barry Song
2026-02-03  7:00   ` Chao Yu [this message]
2026-02-10 21:28 ` [f2fs-dev] " patchwork-bot+f2fs

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=6458f1d3-e38e-4dbf-9202-511abb6a242e@kernel.org \
    --to=chao@kernel.org \
    --cc=21cnbao@gmail.com \
    --cc=jaegeuk@kernel.org \
    --cc=linux-f2fs-devel@lists.sourceforge.net \
    --cc=linux-kernel@vger.kernel.org \
    /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