ANDROID: vendor_hooks: add hooks for f2fs down read
Add hook to solve the priority inversion, In CPU high load scenarios, once the f2fs rwsem was hold by thread as the writer with low priority, then the key thread will be blocked here. So a prio scheme in the hook is needed to optimize this. Bug: 369935682 Change-Id: Ie7f85900169348c961aacda9ccdb7f74e6e77889 Signed-off-by: yipeng xiang <yipengxiang@honor.corp-partner.google.com>
This commit is contained in:
committed by
Treehugger Robot
parent
936ea2ffcd
commit
7a9cbd82c8
@@ -26,6 +26,7 @@
|
||||
#include <trace/hooks/cgroup.h>
|
||||
#include <trace/hooks/sys.h>
|
||||
#include <trace/hooks/iommu.h>
|
||||
#include <trace/hooks/fs.h>
|
||||
#include <trace/hooks/net.h>
|
||||
#include <trace/hooks/pm_domain.h>
|
||||
#include <trace/hooks/cpuidle_psci.h>
|
||||
@@ -111,6 +112,7 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_ufs_send_uic_command);
|
||||
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_io_statistics);
|
||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_cgroup_attach);
|
||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_iommu_setup_dma_ops);
|
||||
|
||||
@@ -20,12 +20,20 @@
|
||||
#include "segment.h"
|
||||
#include "iostat.h"
|
||||
#include <trace/events/f2fs.h>
|
||||
#include <trace/hooks/fs.h>
|
||||
|
||||
#define DEFAULT_CHECKPOINT_IOPRIO (IOPRIO_PRIO_VALUE(IOPRIO_CLASS_BE, 3))
|
||||
|
||||
static struct kmem_cache *ino_entry_slab;
|
||||
struct kmem_cache *f2fs_inode_entry_slab;
|
||||
|
||||
void _trace_android_rvh_f2fs_down_read(wait_queue_head_t *read_waiters,
|
||||
struct rw_semaphore *rwsem, bool *skip)
|
||||
{
|
||||
trace_android_rvh_f2fs_down_read(read_waiters, rwsem, skip);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(_trace_android_rvh_f2fs_down_read);
|
||||
|
||||
void f2fs_stop_checkpoint(struct f2fs_sb_info *sbi, bool end_io,
|
||||
unsigned char reason)
|
||||
{
|
||||
|
||||
@@ -2180,8 +2180,15 @@ static inline int f2fs_rwsem_is_contended(struct f2fs_rwsem *sem)
|
||||
return rwsem_is_contended(&sem->internal_rwsem);
|
||||
}
|
||||
|
||||
void _trace_android_rvh_f2fs_down_read(wait_queue_head_t *read_waiters,
|
||||
struct rw_semaphore *rwsem, bool *skip);
|
||||
|
||||
static inline void f2fs_down_read(struct f2fs_rwsem *sem)
|
||||
{
|
||||
bool skip = false;
|
||||
_trace_android_rvh_f2fs_down_read(&sem->read_waiters, &sem->internal_rwsem, &skip);
|
||||
if (skip)
|
||||
return;
|
||||
#ifdef CONFIG_F2FS_UNFAIR_RWSEM
|
||||
wait_event(sem->read_waiters, down_read_trylock(&sem->internal_rwsem));
|
||||
#else
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0 */
|
||||
#undef TRACE_SYSTEM
|
||||
#define TRACE_SYSTEM fs
|
||||
|
||||
#define TRACE_INCLUDE_PATH trace/hooks
|
||||
|
||||
#if !defined(_TRACE_HOOK_FS_H) || defined(TRACE_HEADER_MULTI_READ)
|
||||
#define _TRACE_HOOK_FS_H
|
||||
|
||||
#include <trace/hooks/vendor_hooks.h>
|
||||
|
||||
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);
|
||||
|
||||
#endif /* _TRACE_HOOK_FS_H */
|
||||
|
||||
/* This part must be outside protection */
|
||||
#include <trace/define_trace.h>
|
||||
Reference in New Issue
Block a user