mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-05 18:41:58 +09:00
ANDROID: fs: add vendor hook to collect IO statistics
Add vendor hook to get metainfo of direct/buffered read and write. Determine hot files in each performance-sensitive user scenario. Bug: 380502059 Change-Id: Ie7604852df637d6664afd72e87bd6d4b14bbc2a2 Signed-off-by: Rui Chen <chenrui9@honor.com>
This commit is contained in:
committed by
Treehugger Robot
parent
b9ba16d91d
commit
dbb9fda3cf
@@ -422,6 +422,7 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_delayacct_compact_start);
|
||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_delayacct_compact_end);
|
||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_delayacct_wpcopy_start);
|
||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_delayacct_wpcopy_end);
|
||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_io_statistics);
|
||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_usb_dev_suspend);
|
||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_usb_dev_resume);
|
||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_sound_usb_support_cpu_suspend);
|
||||
|
||||
@@ -38,6 +38,9 @@
|
||||
#include <linux/uio.h>
|
||||
#include <linux/atomic.h>
|
||||
#include <linux/prefetch.h>
|
||||
#ifndef __GENKSYMS__
|
||||
#include <trace/hooks/mm.h>
|
||||
#endif
|
||||
|
||||
#include "internal.h"
|
||||
|
||||
@@ -1053,6 +1056,12 @@ do_holes:
|
||||
put_page(page);
|
||||
goto out;
|
||||
}
|
||||
|
||||
trace_android_vh_io_statistics(dio->inode->i_mapping,
|
||||
sdio->block_in_file >> sdio->blkfactor,
|
||||
this_chunk_blocks >> sdio->blkfactor,
|
||||
iov_iter_rw(sdio->iter) == READ, true);
|
||||
|
||||
sdio->next_block_for_io += this_chunk_blocks;
|
||||
|
||||
sdio->block_in_file += this_chunk_blocks;
|
||||
|
||||
@@ -12,6 +12,9 @@
|
||||
#include <linux/backing-dev.h>
|
||||
#include <linux/uio.h>
|
||||
#include <linux/task_io_accounting_ops.h>
|
||||
#ifndef __GENKSYMS__
|
||||
#include <trace/hooks/mm.h>
|
||||
#endif
|
||||
#include "trace.h"
|
||||
|
||||
#include "../internal.h"
|
||||
@@ -320,6 +323,9 @@ static loff_t iomap_dio_bio_iter(const struct iomap_iter *iter,
|
||||
goto out;
|
||||
}
|
||||
|
||||
trace_android_vh_io_statistics(inode->i_mapping, pos >> inode->i_blkbits,
|
||||
nr_pages, !(dio->flags & IOMAP_DIO_WRITE), true);
|
||||
|
||||
bio = iomap_dio_alloc_bio(iter, dio, nr_pages, bio_opf);
|
||||
fscrypt_set_bio_crypt_ctx(bio, inode, pos >> inode->i_blkbits,
|
||||
GFP_KERNEL);
|
||||
|
||||
@@ -18,6 +18,10 @@ DECLARE_RESTRICTED_HOOK(android_rvh_shmem_get_folio,
|
||||
TP_PROTO(struct shmem_inode_info *info, struct folio **folio),
|
||||
TP_ARGS(info, folio), 2);
|
||||
|
||||
DECLARE_HOOK(android_vh_io_statistics,
|
||||
TP_PROTO(struct address_space *mapping, unsigned int index,
|
||||
unsigned int nr_page, bool read, bool direct),
|
||||
TP_ARGS(mapping, index, nr_page, read, direct));
|
||||
DECLARE_RESTRICTED_HOOK(android_rvh_set_gfp_zone_flags,
|
||||
TP_PROTO(unsigned int *flags), /* gfp_t *flags */
|
||||
TP_ARGS(flags), 1);
|
||||
|
||||
@@ -3892,6 +3892,7 @@ again:
|
||||
if (unlikely(status < 0))
|
||||
break;
|
||||
}
|
||||
trace_android_vh_io_statistics(mapping, page->index, 1, false, false);
|
||||
cond_resched();
|
||||
|
||||
if (unlikely(status == 0)) {
|
||||
|
||||
@@ -256,6 +256,7 @@ void page_cache_ra_unbounded(struct readahead_control *ractl,
|
||||
continue;
|
||||
}
|
||||
|
||||
trace_android_vh_io_statistics(mapping, index + i, 1, true, false);
|
||||
folio = filemap_alloc_folio(gfp_mask, 0);
|
||||
if (!folio)
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user