netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Patrick Talbert <ptalbert@redhat.com>
To: netdev@vger.kernel.org
Cc: Patrick Talbert <ptalbert@redhat.com>
Subject: [PATCH net-next] [net] softnet_data: Split time_squeeze counter to provide budget_squeeze
Date: Tue, 23 Jan 2018 10:37:14 -0500	[thread overview]
Message-ID: <1516721834-7740-1-git-send-email-ptalbert@redhat.com> (raw)

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 <ptalbert@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	other threads:[~2018-01-23 15:37 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-23 15:37 Patrick Talbert [this message]
2018-01-23 17:07 ` [PATCH net-next] [net] softnet_data: Split time_squeeze counter to provide budget_squeeze Eric Dumazet
2018-01-24 13:25   ` Patrick Talbert

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1516721834-7740-1-git-send-email-ptalbert@redhat.com \
    --to=ptalbert@redhat.com \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).