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).

Signed-off-by: Patrick Talbert <ptalb...@redhat.com>
---
 include/linux/netdevice.h | 1 +
 net/core/dev.c            | 7 +++++--
 net/core/net-procfs.c     | 4 ++--
 3 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index ed0799a..97e923d 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -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;
diff --git a/net/core/dev.c b/net/core/dev.c
index 94435cd..99ce20a 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -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();
diff --git a/net/core/net-procfs.c b/net/core/net-procfs.c
index e010bb8..912e47a 100644
--- a/net/core/net-procfs.c
+++ b/net/core/net-procfs.c
@@ -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;
 }
 
-- 
1.8.3.1

Reply via email to