ANDROID: vendor_hooks: add hooks for f2fs issue checkpoint

Add hooks to solve the priority inversion. while the key thread needs
to update fs data, it should wake and wait for f2fs checkpoint thread
to complete the work. So one scheme is needed to ensure the priority
of checkpoint thread especially in CPU high load scenarios.

Bug: 375088532

Change-Id: Iaa181cd1c8368310d9dd4c78adda6c7add5858b3
Signed-off-by: yipeng xiang <yipengxiang@honor.corp-partner.google.com>
This commit is contained in:
yipeng xiang
2025-01-21 16:55:43 +08:00
committed by Treehugger Robot
parent 7a9cbd82c8
commit 55f8f63a4c
3 changed files with 20 additions and 2 deletions
+2
View File
@@ -113,6 +113,8 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_ufs_send_tm_command);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_ufs_check_int_errors);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_ufs_update_sdev);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_f2fs_down_read);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_f2fs_improve_priority);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_f2fs_restore_priority);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_io_statistics);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_cgroup_attach);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_iommu_setup_dma_ops);
+10 -2
View File
@@ -1903,10 +1903,18 @@ int f2fs_issue_checkpoint(struct f2fs_sb_info *sbi)
if (waitqueue_active(&cprc->ckpt_wait_queue))
wake_up(&cprc->ckpt_wait_queue);
if (cprc->f2fs_issue_ckpt)
if (cprc->f2fs_issue_ckpt) {
bool prio_changed = false;
int saved_prio;
trace_android_vh_f2fs_improve_priority(cprc->f2fs_issue_ckpt, &saved_prio,
&prio_changed);
wait_for_completion(&req.wait);
else
if (prio_changed)
trace_android_vh_f2fs_restore_priority(cprc->f2fs_issue_ckpt, saved_prio);
} else {
flush_remained_ckpt_reqs(sbi, &req);
}
return req.ret;
}
+8
View File
@@ -13,6 +13,14 @@ DECLARE_RESTRICTED_HOOK(android_rvh_f2fs_down_read,
TP_PROTO(wait_queue_head_t *read_waiters, struct rw_semaphore *rwsem, bool *skip),
TP_ARGS(read_waiters, rwsem, skip), 1);
DECLARE_HOOK(android_vh_f2fs_improve_priority,
TP_PROTO(struct task_struct *p, int *saved_prio, bool *skip),
TP_ARGS(p, saved_prio, skip));
DECLARE_HOOK(android_vh_f2fs_restore_priority,
TP_PROTO(struct task_struct *p, int saved_prio),
TP_ARGS(p, saved_prio));
#endif /* _TRACE_HOOK_FS_H */
/* This part must be outside protection */