
hulk inclusion category: feature bugzilla: https://gitee.com/openeuler/release-management/issues/IC9Q31 -------------------------------- For xcall prefetch different cache state, add tracepoints. Signed-off-by: Yipeng Zou <zouyipeng@huawei.com> Signed-off-by: Jinjie Ruan <ruanjinjie@huawei.com> --- fs/eventpoll.c | 6 +++ include/trace/events/fs.h | 93 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 99 insertions(+) diff --git a/fs/eventpoll.c b/fs/eventpoll.c index 181a23ade1e2..3426bf6ffa79 100644 --- a/fs/eventpoll.c +++ b/fs/eventpoll.c @@ -38,6 +38,7 @@ #include <linux/compat.h> #include <linux/rculist.h> #include <net/busy_poll.h> +#include <trace/events/fs.h> /* * LOCKING: @@ -1323,6 +1324,7 @@ int xcall_read(struct prefetch_item *pfi, unsigned int fd, char __user *buf, pfi->pos = 0; hit_return: this_cpu_inc(xcall_cache_hit); + trace_epoll_rc_hit(fd, copy_len); if (pfi->len == 0 || copy_len == 0) transition_state(pfi, XCALL_CACHE_CANCEL, XCALL_CACHE_NONE); @@ -1335,6 +1337,7 @@ int xcall_read(struct prefetch_item *pfi, unsigned int fd, char __user *buf, return -EBADF; reset_pfi_and_retry_vfs_read: this_cpu_inc(xcall_cache_miss); + trace_epoll_rc_miss(fd); pfi->len = 0; cancel_work(&pfi->work); @@ -1348,10 +1351,12 @@ static void prefetch_work_fn(struct work_struct *work) if (!transition_state(pfi, XCALL_CACHE_NONE, XCALL_CACHE_PREFETCH)) return; + trace_epoll_rc_prefetch(pfi->fd, smp_processor_id()); pfi->len = kernel_read(pfi->file, pfi->cache, (1UL << cache_pages_order) * PAGE_SIZE, &pfi->file->f_pos); transition_state(pfi, XCALL_CACHE_PREFETCH, XCALL_CACHE_READY); + trace_epoll_rc_ready(pfi->fd, pfi->len); } static int get_nth_cpu_in_cpumask(const struct cpumask *mask, int n) @@ -1440,6 +1445,7 @@ static void ep_prefetch_item_enqueue(struct eventpoll *ep, struct epitem *epi) t_cpu = pfi->cpu; queue_work_on(t_cpu, rc_work, &pfi->work); + trace_epoll_rc_queue(epi->ffd.fd, t_cpu); } #endif diff --git a/include/trace/events/fs.h b/include/trace/events/fs.h index ee82dad9d9da..bb3a70c44769 100644 --- a/include/trace/events/fs.h +++ b/include/trace/events/fs.h @@ -29,5 +29,98 @@ DECLARE_TRACE(fs_file_release, #endif /* _TRACE_FS_H */ +TRACE_EVENT(epoll_rc_queue, + + TP_PROTO(int fd, int cpu), + + TP_ARGS(fd, cpu), + + TP_STRUCT__entry( + __field(int, fd) + __field(int, cpu) + ), + + TP_fast_assign( + __entry->fd = fd; + __entry->cpu = cpu; + ), + + TP_printk("%d on cpu %d", __entry->fd, __entry->cpu) +); + +TRACE_EVENT(epoll_rc_prefetch, + + TP_PROTO(int fd, int cpu), + + TP_ARGS(fd, cpu), + + TP_STRUCT__entry( + __field(int, fd) + __field(int, cpu) + ), + + TP_fast_assign( + __entry->fd = fd; + __entry->cpu = cpu; + ), + + TP_printk("%d on cpu %d", __entry->fd, __entry->cpu) +); + +TRACE_EVENT(epoll_rc_ready, + + TP_PROTO(int fd, ssize_t len), + + TP_ARGS(fd, len), + + TP_STRUCT__entry( + __field(int, fd) + __field(ssize_t, len) + ), + + TP_fast_assign( + __entry->fd = fd; + __entry->len = len; + ), + + TP_printk("%d, len 0x%lx", __entry->fd, __entry->len) +); + +TRACE_EVENT(epoll_rc_hit, + + TP_PROTO(int fd, ssize_t len), + + TP_ARGS(fd, len), + + TP_STRUCT__entry( + __field(int, fd) + __field(ssize_t, len) + ), + + TP_fast_assign( + __entry->fd = fd; + __entry->len = len; + ), + + TP_printk("%d, len: 0x%lx", __entry->fd, __entry->len) +); + +TRACE_EVENT(epoll_rc_miss, + + TP_PROTO(int fd), + + TP_ARGS(fd), + + TP_STRUCT__entry( + __field(int, fd) + ), + + TP_fast_assign( + __entry->fd = fd; + ), + + TP_printk("%d", __entry->fd) +); + /* This part must be outside protection */ #include <trace/define_trace.h> -- 2.34.1