@@ -44,6 +44,7 @@ struct svc_pool {
struct percpu_counter sp_messages_arrived;
struct percpu_counter sp_sockets_queued;
struct percpu_counter sp_threads_woken;
+ struct percpu_counter sp_no_threads_avail;
unsigned long sp_flags;
} ____cacheline_aligned_in_smp;
@@ -545,6 +545,7 @@ __svc_create(struct svc_program *prog, int nprogs, struct svc_stat *stats,
percpu_counter_init(&pool->sp_messages_arrived, 0, GFP_KERNEL);
percpu_counter_init(&pool->sp_sockets_queued, 0, GFP_KERNEL);
percpu_counter_init(&pool->sp_threads_woken, 0, GFP_KERNEL);
+ percpu_counter_init(&pool->sp_no_threads_avail, 0, GFP_KERNEL);
}
return serv;
@@ -629,6 +630,7 @@ svc_destroy(struct svc_serv **servp)
percpu_counter_destroy(&pool->sp_messages_arrived);
percpu_counter_destroy(&pool->sp_sockets_queued);
percpu_counter_destroy(&pool->sp_threads_woken);
+ percpu_counter_destroy(&pool->sp_no_threads_avail);
}
kfree(serv->sv_pools);
kfree(serv);
@@ -756,7 +758,7 @@ void svc_pool_wake_idle_thread(struct svc_pool *pool)
return;
}
rcu_read_unlock();
-
+ percpu_counter_inc(&pool->sp_no_threads_avail);
}
EXPORT_SYMBOL_GPL(svc_pool_wake_idle_thread);
@@ -1451,15 +1451,16 @@ static int svc_pool_stats_show(struct seq_file *m, void *p)
struct svc_pool *pool = p;
if (p == SEQ_START_TOKEN) {
- seq_puts(m, "# pool packets-arrived sockets-enqueued threads-woken threads-timedout\n");
+ seq_puts(m, "# pool packets-arrived sockets-enqueued threads-woken threads-timedout no-threads-avail\n");
return 0;
}
- seq_printf(m, "%u %llu %llu %llu 0\n",
+ seq_printf(m, "%u %llu %llu %llu 0 %llu\n",
pool->sp_id,
percpu_counter_sum_positive(&pool->sp_messages_arrived),
percpu_counter_sum_positive(&pool->sp_sockets_queued),
- percpu_counter_sum_positive(&pool->sp_threads_woken));
+ percpu_counter_sum_positive(&pool->sp_threads_woken),
+ percpu_counter_sum_positive(&pool->sp_no_threads_avail));
return 0;
}
Add a new percpu counter and pool_stat that can track how often the kernel went to wake up a thread, but they all were busy. Signed-off-by: Jeff Layton <jlayton@kernel.org> --- include/linux/sunrpc/svc.h | 1 + net/sunrpc/svc.c | 4 +++- net/sunrpc/svc_xprt.c | 7 ++++--- 3 files changed, 8 insertions(+), 4 deletions(-)