ANDROID: vendor_hooks:vendor hook for control memory dirty rate

When the IO pressure increases or the system performs dirty
page balancing, the frame rate of the foreground application
may become unstable. Therefore, a hook point is added to limit
the buffer IO rate from the source.

Bug: 262189942
Change-Id: I5214d611a388c5e8d87dc44ffde86ead1834ddff
Signed-off-by: xiaofeng <xiaofeng5@xiaomi.com>
This commit is contained in:
xiaofeng 2022-12-12 17:05:52 +08:00 committed by Treehugger Robot
parent c959a3fc91
commit 508ca06639
3 changed files with 8 additions and 0 deletions

View file

@ -289,3 +289,4 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_madvise_swapin_walk_pmd_entry);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_process_madvise_end);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_smaps_pte_entry);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_show_smap);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_ctl_dirty_rate);

View file

@ -90,6 +90,10 @@ DECLARE_HOOK(android_vh_show_smap,
unsigned long same, unsigned long huge),
TP_ARGS(m, writeback, same, huge));
DECLARE_RESTRICTED_HOOK(android_rvh_ctl_dirty_rate,
TP_PROTO(void *unused),
TP_ARGS(unused), 1);
#endif /* _TRACE_HOOK_MM_H */
/* This part must be outside protection */

View file

@ -38,6 +38,7 @@
#include <linux/sched/signal.h>
#include <linux/mm_inline.h>
#include <trace/events/writeback.h>
#include <trace/hooks/mm.h>
#include "internal.h"
@ -1890,6 +1891,8 @@ int balance_dirty_pages_ratelimited_flags(struct address_space *mapping,
if (!(bdi->capabilities & BDI_CAP_WRITEBACK))
return ret;
trace_android_rvh_ctl_dirty_rate(NULL);
if (inode_cgwb_enabled(inode))
wb = wb_get_create_current(bdi, GFP_KERNEL);
if (!wb)