Re: [PATCH] f2fs: move f2fs to use reader-unfair rwsems

From: Waiman Long
Date: Mon Jan 10 2022 - 11:18:35 EST



On 1/10/22 03:05, Christoph Hellwig wrote:
Adding the locking primitive maintainers to this patch adding open coded
locking primitives..

On Sat, Jan 08, 2022 at 08:46:17AM -0800, Jaegeuk Kim wrote:
From: Tim Murray <timmurray@xxxxxxxxxx>

f2fs rw_semaphores work better if writers can starve readers,
especially for the checkpoint thread, because writers are strictly
more important than reader threads. This prevents significant priority
inversion between low-priority readers that blocked while trying to
acquire the read lock and a second acquisition of the write lock that
might be blocking high priority work.

Signed-off-by: Tim Murray <timmurray@xxxxxxxxxx>
Signed-off-by: Jaegeuk Kim <jaegeuk@xxxxxxxxxx>

We could certainly implement a down_read() variant (e.g. down_read_lowprio()) with its own slowpath function to do this within the rwsem code as long as there is a good use-case for this kind of functionality.

Cheers,
Longman