ANDROID: vendor_hooks: Add hooks to record the I/O statistics of swap:
android_vh_count_pswpin, Update the write I/O statistics of the swap; android_vh_count_pswpout, Update the read I/O statistics of the swap; android_vh_count_swpout_vm_event, Replace count_swpout_vm_event with adding updating the I/O statistics of the swap; Bug: 234214858 Signed-off-by: Bing Han <bing.han@transsion.com> Change-Id: I4eb69db59fe2d822555a508c2f0c6cd5ca9083d1
This commit is contained in:
parent
5bc9b10c45
commit
851672a4b2
@ -412,6 +412,9 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_cow_user_page);
|
||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_swapin_add_anon_rmap);
|
||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_waiting_for_page_migration);
|
||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_migrate_page_states);
|
||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_count_pswpin);
|
||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_count_pswpout);
|
||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_count_swpout_vm_event);
|
||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_page_isolated_for_reclaim);
|
||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_inactive_is_low);
|
||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_snapshot_refaults);
|
||||
|
@ -164,6 +164,15 @@ DECLARE_HOOK(android_vh_waiting_for_page_migration,
|
||||
DECLARE_HOOK(android_vh_migrate_page_states,
|
||||
TP_PROTO(struct page *page, struct page *newpage),
|
||||
TP_ARGS(page, newpage));
|
||||
DECLARE_HOOK(android_vh_count_pswpin,
|
||||
TP_PROTO(struct swap_info_struct *sis),
|
||||
TP_ARGS(sis));
|
||||
DECLARE_HOOK(android_vh_count_pswpout,
|
||||
TP_PROTO(struct swap_info_struct *sis),
|
||||
TP_ARGS(sis));
|
||||
DECLARE_HOOK(android_vh_count_swpout_vm_event,
|
||||
TP_PROTO(struct swap_info_struct *sis, struct page *page, bool *skip),
|
||||
TP_ARGS(sis, page, skip));
|
||||
DECLARE_HOOK(android_vh_page_isolated_for_reclaim,
|
||||
TP_PROTO(struct mm_struct *mm, struct page *page),
|
||||
TP_ARGS(mm, page));
|
||||
|
13
mm/page_io.c
13
mm/page_io.c
@ -25,6 +25,7 @@
|
||||
#include <linux/psi.h>
|
||||
#include <linux/uio.h>
|
||||
#include <linux/sched/task.h>
|
||||
#include <trace/hooks/mm.h>
|
||||
|
||||
static struct bio *get_swap_bio(gfp_t gfp_flags,
|
||||
struct page *page, bio_end_io_t end_io)
|
||||
@ -256,6 +257,7 @@ int __swap_writepage(struct page *page, struct writeback_control *wbc,
|
||||
struct bio *bio;
|
||||
int ret;
|
||||
struct swap_info_struct *sis = page_swap_info(page);
|
||||
bool skip = false;
|
||||
|
||||
VM_BUG_ON_PAGE(!PageSwapCache(page), page);
|
||||
if (data_race(sis->flags & SWP_FS_OPS)) {
|
||||
@ -277,6 +279,7 @@ int __swap_writepage(struct page *page, struct writeback_control *wbc,
|
||||
unlock_page(page);
|
||||
ret = mapping->a_ops->direct_IO(&kiocb, &from);
|
||||
if (ret == PAGE_SIZE) {
|
||||
trace_android_vh_count_pswpout(sis);
|
||||
count_vm_event(PSWPOUT);
|
||||
ret = 0;
|
||||
} else {
|
||||
@ -301,6 +304,8 @@ int __swap_writepage(struct page *page, struct writeback_control *wbc,
|
||||
|
||||
ret = bdev_write_page(sis->bdev, swap_page_sector(page), page, wbc);
|
||||
if (!ret) {
|
||||
trace_android_vh_count_swpout_vm_event(sis, page, &skip);
|
||||
if (!skip)
|
||||
count_swpout_vm_event(page);
|
||||
return 0;
|
||||
}
|
||||
@ -313,6 +318,8 @@ int __swap_writepage(struct page *page, struct writeback_control *wbc,
|
||||
}
|
||||
bio->bi_opf = REQ_OP_WRITE | REQ_SWAP | wbc_to_write_flags(wbc);
|
||||
bio_associate_blkg_from_page(bio, page);
|
||||
trace_android_vh_count_swpout_vm_event(sis, page, &skip);
|
||||
if (!skip)
|
||||
count_swpout_vm_event(page);
|
||||
set_page_writeback(page);
|
||||
unlock_page(page);
|
||||
@ -352,14 +359,17 @@ int swap_readpage(struct page *page, bool synchronous)
|
||||
struct address_space *mapping = swap_file->f_mapping;
|
||||
|
||||
ret = mapping->a_ops->readpage(swap_file, page);
|
||||
if (!ret)
|
||||
if (!ret) {
|
||||
trace_android_vh_count_pswpin(sis);
|
||||
count_vm_event(PSWPIN);
|
||||
}
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (sis->flags & SWP_SYNCHRONOUS_IO) {
|
||||
ret = bdev_read_page(sis->bdev, swap_page_sector(page), page);
|
||||
if (!ret) {
|
||||
trace_android_vh_count_pswpin(sis);
|
||||
count_vm_event(PSWPIN);
|
||||
goto out;
|
||||
}
|
||||
@ -383,6 +393,7 @@ int swap_readpage(struct page *page, bool synchronous)
|
||||
get_task_struct(current);
|
||||
bio->bi_private = current;
|
||||
}
|
||||
trace_android_vh_count_pswpin(sis);
|
||||
count_vm_event(PSWPIN);
|
||||
bio_get(bio);
|
||||
qc = submit_bio(bio);
|
||||
|
Loading…
Reference in New Issue
Block a user