summaryrefslogtreecommitdiff
path: root/Documentation
diff options
context:
space:
mode:
authorChao Yu <chao@kernel.org>2026-01-30 21:28:08 +0800
committerJaegeuk Kim <jaegeuk@kernel.org>2026-01-31 03:24:39 +0000
commit07de55cbf5762cb4a7e9e0db7aba5c10c8cfe079 (patch)
tree423f23b83359ddbd7878b660a0735643c8301f11 /Documentation
parentd860974a7e38d35e9e2c4dc8a9f4223b38b6ad99 (diff)
f2fs: fix lock priority inversion issue
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. Meanwhile, introducing two new sysfs nodes: - /sys/fs/f2fs/<disk>/adjust_lock_priority, it is used to control whether the functionality is enable or not. ========== ================== Flag_Value Flag_Description ========== ================== 0x00000000 Disabled (default) 0x00000001 cp_rwsem 0x00000002 node_change 0x00000004 node_write 0x00000008 gc_lock 0x00000010 cp_global 0x00000020 io_rwsem ========== ================== - /sys/fs/f2fs/<disk>/lock_duration_priority, it is used to control priority threshold. Signed-off-by: Chao Yu <chao@kernel.org> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Diffstat (limited to 'Documentation')
-rw-r--r--Documentation/ABI/testing/sysfs-fs-f2fs24
1 files changed, 24 insertions, 0 deletions
diff --git a/Documentation/ABI/testing/sysfs-fs-f2fs b/Documentation/ABI/testing/sysfs-fs-f2fs
index 9a8ec2290f68..ea6474db8a31 100644
--- a/Documentation/ABI/testing/sysfs-fs-f2fs
+++ b/Documentation/ABI/testing/sysfs-fs-f2fs
@@ -963,3 +963,27 @@ Description: This sysfs entry can be used to change type of injected timeout:
0x00000003 Simulate Non-IO type sleep time
0x00000004 Simulate runnable time
========== ===============================
+
+What: /sys/fs/f2fs/<disk>/adjust_lock_priority
+Date: January 2026
+Contact: "Chao Yu" <chao@kernel.org>
+Description: This sysfs entry can be used to enable/disable to adjust priority for task
+ which is in critical region covered by lock.
+ ========== ==================
+ Flag_Value Flag_Description
+ ========== ==================
+ 0x00000000 Disabled (default)
+ 0x00000001 cp_rwsem
+ 0x00000002 node_change
+ 0x00000004 node_write
+ 0x00000008 gc_lock
+ 0x00000010 cp_global
+ 0x00000020 io_rwsem
+ ========== ==================
+
+What: /sys/fs/f2fs/<disk>/lock_duration_priority
+Date: January 2026
+Contact: "Chao Yu" <chao@kernel.org>
+Description: f2fs can tune priority of thread which has entered into critical region covered by
+ f2fs rwsemphore lock. This sysfs entry can be used to control priority value, the
+ range is [100,139], by default the value is 120.