Skip to contentSkip to conversation

softnet_data: Split time_squeeze counter to provide budget_squeeze

PATCH In review Patrick Talbert 2 participants 3 messages Jan 23, 2018 – Jan 24, 2018

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 softnet_data: Split time_squeeze counter to provide budget_squeeze

Add a 'budget_squeeze' counter to be able to differenciate between a NAPI poll ending with outstanding work because of a lack of budget (netdev_budget) versus ending because of a lack of time (netdev_budget_usecs).

---
 include/linux/netdevice.h | 1 +
 net/core/dev.c            | 7 +++++--
 net/core/net-procfs.c     | 4 ++--
 3 files changed, 8 insertions(+), 4 deletions(-)
include/linux/netdevice.h +1 -0
index ed0799a..97e923d 100644
@@ -2789,6 +2789,7 @@ struct softnet_data {
 	/* stats */
 	unsigned int		processed;
 	unsigned int		time_squeeze;
+	unsigned int		budget_squeeze;
 	unsigned int		received_rps;
 #ifdef CONFIG_RPS
 	struct softnet_data	*rps_ipi_list;
net/core/dev.c +5 -2
index 94435cd..99ce20a 100644
@@ -5749,11 +5749,14 @@ static __latent_entropy void net_rx_action(struct softirq_action *h)
 		 * Allow this to run for 2 jiffies since which will allow
 		 * an average latency of 1.5/HZ.
 		 */
-		if (unlikely(budget <= 0 ||
-			     time_after_eq(jiffies, time_limit))) {
+		if (unlikely(time_after_eq(jiffies, time_limit))) {
 			sd->time_squeeze++;
 			break;
 		}
+		if (unlikely(budget <= 0)) {
+			sd->budget_squeeze++;
+			break;
+		}
 	}
 
 	local_irq_disable();
net/core/net-procfs.c +2 -2
index e010bb8..912e47a 100644
@@ -160,11 +160,11 @@ static int softnet_seq_show(struct seq_file *seq, void *v)
 #endif
 
 	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\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, sd->budget_squeeze);
 	return 0;
 }
 
Signature · 1 line
1.8.3.1
#1 lore raw
Quoted 13 lines · Patrick Talbert

Add a 'budget_squeeze' counter to be able to differenciate between a NAPI poll ending with outstanding work because of a lack of budget (netdev_budget) versus ending because of a lack of time (netdev_budget_usecs).

net/core/net-procfs.c +0 -0
@@ -160,11 +160,11 @@ static int softnet_seq_show(struct seq_file *seq, void *v)
 #endif
 

net/core/net-procfs.c static int softnet_seq_show(struct seq_file *seq, void *v) · line 169

Quoted 10 lines
net/core/net-procfs.c +2 -2
 	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\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, sd->budget_squeeze);
 	return 0;
 }

Please no more updates on /proc files. We want to deprecate them eventually.

#2 lore raw
Quoted 14 lines · Eric Dumazet
Quoted 13 lines · Patrick Talbert

Add a 'budget_squeeze' counter to be able to differenciate between a NAPI poll ending with outstanding work because of a lack of budget (netdev_budget) versus ending because of a lack of time (netdev_budget_usecs).

net/core/net-procfs.c +0 -0
@@ -160,11 +160,11 @@ static int softnet_seq_show(struct seq_file *seq, void *v)
 #endif
 
Quoted 15 lines

net/core/net-procfs.c static int softnet_seq_show(struct seq_file *seq, void *v) · line 169

Quoted 10 lines
net/core/net-procfs.c +2 -2
      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\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, sd->budget_squeeze);
      return 0;
 }

Please no more updates on /proc files. We want to deprecate them eventually.

Fair enough. How is the commit without the net-procfs.c change? Also, I apologize for not knowing, but if it is preferred for such info to no longer be exposed via procfs, where should it be instead?

Thank you,

Patrick