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 6d9e986186
commit b3084d784b
3 changed files with 6 additions and 1 deletions

View File

@@ -412,7 +412,7 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_init_aes_encrypt);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_skip_swap_map_write);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_post_image_save);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_dm_update_clone_bio);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_ctl_dirty_rate);
/*
* For type visibility
*/

View File

@@ -159,6 +159,9 @@ DECLARE_HOOK(android_vh_kmalloc_slab,
DECLARE_HOOK(android_vh_madvise_cold_or_pageout,
TP_PROTO(struct vm_area_struct *vma, bool *allow_shared),
TP_ARGS(vma, allow_shared));
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

@@ -1886,6 +1886,8 @@ void balance_dirty_pages_ratelimited(struct address_space *mapping)
if (!(bdi->capabilities & BDI_CAP_WRITEBACK))
return;
trace_android_rvh_ctl_dirty_rate(NULL);
if (inode_cgwb_enabled(inode))
wb = wb_get_create_current(bdi, GFP_KERNEL);
if (!wb)