]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
sunrpc: new tracepoints around svc thread wakeups
authorJeff Layton <jlayton@kernel.org>
Wed, 28 May 2025 00:12:48 +0000 (20:12 -0400)
committerChuck Lever <chuck.lever@oracle.com>
Mon, 14 Jul 2025 16:46:38 +0000 (12:46 -0400)
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>
include/trace/events/sunrpc.h
net/sunrpc/svc.c

index aad697da158007f3c7d15a114bb46f2299c33c0a..ff11fa07cbe3cd6863d281af4f6ed1d3684cf9f0 100644 (file)
@@ -2123,22 +2123,35 @@ TRACE_EVENT(svc_xprt_accept,
        )
 );
 
-TRACE_EVENT(svc_wake_up,
-       TP_PROTO(int pid),
+DECLARE_EVENT_CLASS(svc_pool_thread_event,
+       TP_PROTO(const struct svc_pool *pool, pid_t pid),
 
-       TP_ARGS(pid),
+       TP_ARGS(pool, pid),
 
        TP_STRUCT__entry(
-               __field(int, pid)
+               __field(unsigned int, pool_id)
+               __field(pid_t, pid)
        ),
 
        TP_fast_assign(
+               __entry->pool_id = pool->sp_id;
                __entry->pid = pid;
        ),
 
-       TP_printk("pid=%d", __entry->pid)
+       TP_printk("pool=%u pid=%d", __entry->pool_id, __entry->pid)
 );
 
+#define DEFINE_SVC_POOL_THREAD_EVENT(name) \
+       DEFINE_EVENT(svc_pool_thread_event, svc_pool_thread_##name, \
+                       TP_PROTO( \
+                               const struct svc_pool *pool, pid_t pid \
+                       ), \
+                       TP_ARGS(pool, pid))
+
+DEFINE_SVC_POOL_THREAD_EVENT(wake);
+DEFINE_SVC_POOL_THREAD_EVENT(running);
+DEFINE_SVC_POOL_THREAD_EVENT(noidle);
+
 TRACE_EVENT(svc_alloc_arg_err,
        TP_PROTO(
                unsigned int requested,
index 9c93b854e809ed1a833846c1c4751b861879af32..9abdbcbf247323207cba13546173b8fd28a15e24 100644 (file)
@@ -751,14 +751,16 @@ void svc_pool_wake_idle_thread(struct svc_pool *pool)
                WRITE_ONCE(rqstp->rq_qtime, ktime_get());
                if (!task_is_running(rqstp->rq_task)) {
                        wake_up_process(rqstp->rq_task);
-                       trace_svc_wake_up(rqstp->rq_task->pid);
+                       trace_svc_pool_thread_wake(pool, rqstp->rq_task->pid);
                        percpu_counter_inc(&pool->sp_threads_woken);
+               } else {
+                       trace_svc_pool_thread_running(pool, rqstp->rq_task->pid);
                }
                rcu_read_unlock();
                return;
        }
        rcu_read_unlock();
-
+       trace_svc_pool_thread_noidle(pool, 0);
 }
 EXPORT_SYMBOL_GPL(svc_pool_wake_idle_thread);