Skip to content

Commit f26c930

Browse files
jtlaytonchucklever
authored andcommitted
sunrpc: new tracepoints around svc thread wakeups
Convert the svc_wake_up tracepoint into svc_pool_thread_event class. Have it also record the pool id, and add new tracepoints for when the thread is already running and for when there are no idle threads. Signed-off-by: Jeff Layton <jlayton@kernel.org> Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
1 parent 1aa3f76 commit f26c930

2 files changed

Lines changed: 22 additions & 7 deletions

File tree

include/trace/events/sunrpc.h

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2123,22 +2123,35 @@ TRACE_EVENT(svc_xprt_accept,
21232123
)
21242124
);
21252125

2126-
TRACE_EVENT(svc_wake_up,
2127-
TP_PROTO(int pid),
2126+
DECLARE_EVENT_CLASS(svc_pool_thread_event,
2127+
TP_PROTO(const struct svc_pool *pool, pid_t pid),
21282128

2129-
TP_ARGS(pid),
2129+
TP_ARGS(pool, pid),
21302130

21312131
TP_STRUCT__entry(
2132-
__field(int, pid)
2132+
__field(unsigned int, pool_id)
2133+
__field(pid_t, pid)
21332134
),
21342135

21352136
TP_fast_assign(
2137+
__entry->pool_id = pool->sp_id;
21362138
__entry->pid = pid;
21372139
),
21382140

2139-
TP_printk("pid=%d", __entry->pid)
2141+
TP_printk("pool=%u pid=%d", __entry->pool_id, __entry->pid)
21402142
);
21412143

2144+
#define DEFINE_SVC_POOL_THREAD_EVENT(name) \
2145+
DEFINE_EVENT(svc_pool_thread_event, svc_pool_thread_##name, \
2146+
TP_PROTO( \
2147+
const struct svc_pool *pool, pid_t pid \
2148+
), \
2149+
TP_ARGS(pool, pid))
2150+
2151+
DEFINE_SVC_POOL_THREAD_EVENT(wake);
2152+
DEFINE_SVC_POOL_THREAD_EVENT(running);
2153+
DEFINE_SVC_POOL_THREAD_EVENT(noidle);
2154+
21422155
TRACE_EVENT(svc_alloc_arg_err,
21432156
TP_PROTO(
21442157
unsigned int requested,

net/sunrpc/svc.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -751,14 +751,16 @@ void svc_pool_wake_idle_thread(struct svc_pool *pool)
751751
WRITE_ONCE(rqstp->rq_qtime, ktime_get());
752752
if (!task_is_running(rqstp->rq_task)) {
753753
wake_up_process(rqstp->rq_task);
754-
trace_svc_wake_up(rqstp->rq_task->pid);
754+
trace_svc_pool_thread_wake(pool, rqstp->rq_task->pid);
755755
percpu_counter_inc(&pool->sp_threads_woken);
756+
} else {
757+
trace_svc_pool_thread_running(pool, rqstp->rq_task->pid);
756758
}
757759
rcu_read_unlock();
758760
return;
759761
}
760762
rcu_read_unlock();
761-
763+
trace_svc_pool_thread_noidle(pool, 0);
762764
}
763765
EXPORT_SYMBOL_GPL(svc_pool_wake_idle_thread);
764766

0 commit comments

Comments
 (0)