From: Amritha Nambiar <amritha.nambiar@intel.com>
To: netdev@vger.kernel.org, davem@davemloft.net
Cc: alexander.h.duyck@intel.com, willemdebruijn.kernel@gmail.com,
amritha.nambiar@intel.com, sridhar.samudrala@intel.com,
edumazet@google.com, hannes@stressinduktion.org,
tom@herbertland.com
Subject: [net-next PATCH v3 2/5] net: Use static_key for XPS maps
Date: Tue, 05 Jun 2018 01:37:55 -0700 [thread overview]
Message-ID: <152818787570.20862.13192404756533656290.stgit@anamdev.jf.intel.com> (raw)
In-Reply-To: <152818727065.20862.10108275498797168689.stgit@anamdev.jf.intel.com>
Use static_key for XPS maps to reduce the cost of extra map checks,
similar to how it is used for RPS and RFS.
Signed-off-by: Amritha Nambiar <amritha.nambiar@intel.com>
---
net/core/dev.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/net/core/dev.c b/net/core/dev.c
index 156acbe..bba755f 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -2081,6 +2081,8 @@ int netdev_txq_to_tc(struct net_device *dev, unsigned int txq)
EXPORT_SYMBOL(netdev_txq_to_tc);
#ifdef CONFIG_XPS
+struct static_key xps_needed __read_mostly;
+EXPORT_SYMBOL(xps_needed);
static DEFINE_MUTEX(xps_map_mutex);
#define xmap_dereference(P) \
rcu_dereference_protected((P), lockdep_is_held(&xps_map_mutex))
@@ -2189,6 +2191,7 @@ static void netif_reset_xps_queues(struct net_device *dev, u16 offset,
out_no_maps:
type++;
}
+ static_key_slow_dec(&xps_needed);
mutex_unlock(&xps_map_mutex);
}
@@ -2309,6 +2312,8 @@ int __netif_set_xps_queue(struct net_device *dev, const unsigned long *mask,
if (!new_dev_maps)
goto out_no_new_maps;
+ static_key_slow_inc(&xps_needed);
+
for (j = -1; j = attrmask_next(j, possible_mask, nr_ids),
j < nr_ids;) {
/* copy maps belonging to foreign traffic classes */
@@ -3481,6 +3486,9 @@ static inline int get_xps_queue(struct net_device *dev, struct sk_buff *skb)
struct xps_map *map;
int queue_index = -1;
+ if (!static_key_false(&xps_needed))
+ return -1;
+
rcu_read_lock();
dev_maps = rcu_dereference(dev->xps_cpus_map);
if (dev_maps) {
next prev parent reply other threads:[~2018-06-05 8:41 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-06-05 8:37 [net-next PATCH v3 0/5] Symmetric queue selection using XPS for Rx queues Amritha Nambiar
2018-06-05 8:37 ` [net-next PATCH v3 1/5] net: Refactor XPS for CPUs and " Amritha Nambiar
2018-06-05 8:37 ` Amritha Nambiar [this message]
2018-06-05 8:38 ` [net-next PATCH v3 3/5] net: Enable Tx queue selection based on " Amritha Nambiar
2018-06-06 18:56 ` Willem de Bruijn
2018-06-06 19:08 ` Samudrala, Sridhar
2018-06-06 19:13 ` Willem de Bruijn
2018-06-06 23:02 ` Nambiar, Amritha
[not found] ` <CALx6S35273zLb-WDs-5r+b_eWoB8jmZfUJvYRDHWNo4fjJLyag@mail.gmail.com>
2018-06-06 22:52 ` Nambiar, Amritha
2018-06-05 8:38 ` [net-next PATCH v3 4/5] net-sysfs: Add interface for Rx queue(s) map per Tx queue Amritha Nambiar
2018-06-05 8:38 ` [net-next PATCH v3 5/5] Documentation: Add explanation for XPS using Rx-queue(s) map Amritha Nambiar
2018-06-05 16:33 ` [net-next PATCH v3 0/5] Symmetric queue selection using XPS for Rx queues David Miller
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=152818787570.20862.13192404756533656290.stgit@anamdev.jf.intel.com \
--to=amritha.nambiar@intel.com \
--cc=alexander.h.duyck@intel.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=hannes@stressinduktion.org \
--cc=netdev@vger.kernel.org \
--cc=sridhar.samudrala@intel.com \
--cc=tom@herbertland.com \
--cc=willemdebruijn.kernel@gmail.com \
/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