All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net-next] net-sysfs: add backlog len and CPU id to softnet data
@ 2020-09-18 16:00 Paolo Abeni
  2020-09-21 20:56 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Paolo Abeni @ 2020-09-18 16:00 UTC (permalink / raw)
  To: netdev; +Cc: David S. Miller, Marcelo Tosatti

Currently the backlog status in not exposed to user-space.
Since long backlogs (or simply not empty ones) can be a
source of noticeable latency, -RT deployments need some way
to inspect it.

Additionally, there isn't a direct match between 'softnet_stat'
lines and the related CPU - sd for offline CPUs are not dumped -
so this patch also includes the CPU id into such entry.

Signed-off-by: Paolo Abeni <pabeni@redhat.com>
---
 net/core/net-procfs.c | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/net/core/net-procfs.c b/net/core/net-procfs.c
index 6bbd06f7dc7d..c714e6a9dad4 100644
--- a/net/core/net-procfs.c
+++ b/net/core/net-procfs.c
@@ -116,6 +116,12 @@ static int dev_seq_show(struct seq_file *seq, void *v)
 	return 0;
 }
 
+static u32 softnet_backlog_len(struct softnet_data *sd)
+{
+	return skb_queue_len_lockless(&sd->input_pkt_queue) +
+	       skb_queue_len_lockless(&sd->process_queue);
+}
+
 static struct softnet_data *softnet_get_online(loff_t *pos)
 {
 	struct softnet_data *sd = NULL;
@@ -159,12 +165,17 @@ static int softnet_seq_show(struct seq_file *seq, void *v)
 	rcu_read_unlock();
 #endif
 
+	/* the index is the CPU id owing this sd. Since offline CPUs are not
+	 * displayed, it would be othrwise not trivial for the user-space
+	 * mapping the data a specific CPU
+	 */
 	seq_printf(seq,
-		   "%08x %08x %08x %08x %08x %08x %08x %08x %08x %08x %08x\n",
+		   "%08x %08x %08x %08x %08x %08x %08x %08x %08x %08x %08x %08x %08x\n",
 		   sd->processed, sd->dropped, sd->time_squeeze, 0,
 		   0, 0, 0, 0, /* was fastroute */
 		   0,	/* was cpu_collision */
-		   sd->received_rps, flow_limit_count);
+		   sd->received_rps, flow_limit_count,
+		   softnet_backlog_len(sd), (int)seq->index);
 	return 0;
 }
 
-- 
2.26.2


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH net-next] net-sysfs: add backlog len and CPU id to softnet data
  2020-09-18 16:00 [PATCH net-next] net-sysfs: add backlog len and CPU id to softnet data Paolo Abeni
@ 2020-09-21 20:56 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2020-09-21 20:56 UTC (permalink / raw)
  To: pabeni; +Cc: netdev, mtosatti

From: Paolo Abeni <pabeni@redhat.com>
Date: Fri, 18 Sep 2020 18:00:46 +0200

> Currently the backlog status in not exposed to user-space.
> Since long backlogs (or simply not empty ones) can be a
> source of noticeable latency, -RT deployments need some way
> to inspect it.
> 
> Additionally, there isn't a direct match between 'softnet_stat'
> lines and the related CPU - sd for offline CPUs are not dumped -
> so this patch also includes the CPU id into such entry.
> 
> Signed-off-by: Paolo Abeni <pabeni@redhat.com>

Looks good, applied, thanks.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-09-21 20:57 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-18 16:00 [PATCH net-next] net-sysfs: add backlog len and CPU id to softnet data Paolo Abeni
2020-09-21 20:56 ` David Miller

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.