ANDROID: mm: add vendor hook to trace swap bio charge

Add a vendor hook `android_vh_swap_bio_charge` in swap read path
to allow vendors to monitor  behavior when a swap bio
is submitted.

Bug: 433890875

Change-Id: I742978c7cb5c7d678d585b49e3466920f99e4fba
Signed-off-by: Dongdong zhang <zhangdongdong5@xiaomi.com>
This commit is contained in:
Dongdong zhang
2025-07-24 20:07:06 +08:00
committed by Todd Kjos
parent 6aa695ed1b
commit ee117211e4
3 changed files with 5 additions and 0 deletions
+1
View File
@@ -587,3 +587,4 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_gzvm_handle_demand_page_post);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_gzvm_destroy_vm_post_process);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_usb_dev_suspend);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_usb_dev_resume);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_swap_bio_charge);
+3
View File
@@ -540,6 +540,9 @@ DECLARE_HOOK(android_vh_filemap_add_folio,
DECLARE_HOOK(android_vh_gcma_cc_store_page_bypass,
TP_PROTO(bool *bypass),
TP_ARGS(bypass));
DECLARE_HOOK(android_vh_swap_bio_charge,
TP_PROTO(struct bio *bio),
TP_ARGS(bio));
#endif /* _TRACE_HOOK_MM_H */
/* This part must be outside protection */
+1
View File
@@ -594,6 +594,7 @@ static void swap_read_folio_bdev_sync(struct folio *folio,
get_task_struct(current);
count_vm_events(PSWPIN, folio_nr_pages(folio));
submit_bio_wait(&bio);
trace_android_vh_swap_bio_charge(&bio);
__end_swap_bio_read(&bio);
put_task_struct(current);
}