Skip to content

Commit

Permalink
net-sysfs: add backlog len and CPU id to softnet data
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
Paolo Abeni authored and davem330 committed Sep 21, 2020
1 parent c4f084e commit 7d58e65
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions net/core/net-procfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
}

Expand Down

0 comments on commit 7d58e65

Please sign in to comment.