* [PATCH net-next] tuntap: calculate rps hash only when needed
@ 2016-04-26 1:55 Jason Wang
2016-04-26 2:30 ` kbuild test robot
2016-04-26 3:12 ` Jason Wang
0 siblings, 2 replies; 3+ messages in thread
From: Jason Wang @ 2016-04-26 1:55 UTC (permalink / raw)
To: davem, netdev, linux-kernel; +Cc: Jason Wang, Michael S. Tsirkin
There's no need to calculate rps hash if it was not enabled. So this
patch export rps_needed and check it before trying to get rps
hash. Tests (using pktgen to inject packets to guest) shows this can
improve pps about 13% (when rps is disabled).
Before:
~1150000 pps
After:
~1300000 pps
Cc: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Jason Wang <jasowang@redhat.com>
---
drivers/net/tun.c | 2 +-
net/core/dev.c | 1 +
2 files changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/net/tun.c b/drivers/net/tun.c
index afdf950..746877f 100644
--- a/drivers/net/tun.c
+++ b/drivers/net/tun.c
@@ -819,7 +819,7 @@ static netdev_tx_t tun_net_xmit(struct sk_buff *skb, struct net_device *dev)
if (txq >= numqueues)
goto drop;
- if (numqueues == 1) {
+ if (numqueues == 1 && static_key_false(&rps_needed)) {
/* Select queue was not called for the skbuff, so we extract the
* RPS hash and save it into the flow_table here.
*/
diff --git a/net/core/dev.c b/net/core/dev.c
index b9bcbe7..d4ba936 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -3428,6 +3428,7 @@ u32 rps_cpu_mask __read_mostly;
EXPORT_SYMBOL(rps_cpu_mask);
struct static_key rps_needed __read_mostly;
+EXPORT_SYMBOL(rps_needed);
static struct rps_dev_flow *
set_rps_cpu(struct net_device *dev, struct sk_buff *skb,
--
1.8.3.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH net-next] tuntap: calculate rps hash only when needed
2016-04-26 1:55 [PATCH net-next] tuntap: calculate rps hash only when needed Jason Wang
@ 2016-04-26 2:30 ` kbuild test robot
2016-04-26 3:12 ` Jason Wang
1 sibling, 0 replies; 3+ messages in thread
From: kbuild test robot @ 2016-04-26 2:30 UTC (permalink / raw)
To: Jason Wang
Cc: kbuild-all, davem, netdev, linux-kernel, Jason Wang, Michael S. Tsirkin
[-- Attachment #1: Type: text/plain, Size: 1464 bytes --]
Hi,
[auto build test ERROR on net-next/master]
url: https://github.com/0day-ci/linux/commits/Jason-Wang/tuntap-calculate-rps-hash-only-when-needed/20160426-095825
config: xtensa-allyesconfig (attached as .config)
compiler:
reproduce:
wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=xtensa
All errors (new ones prefixed by >>):
drivers/net/tun.c: In function 'tun_net_xmit':
>> drivers/net/tun.c:836:42: error: 'rps_needed' undeclared (first use in this function)
if (numqueues == 1 && static_key_false(&rps_needed)) {
^
drivers/net/tun.c:836:42: note: each undeclared identifier is reported only once for each function it appears in
vim +/rps_needed +836 drivers/net/tun.c
830 numqueues = ACCESS_ONCE(tun->numqueues);
831
832 /* Drop packet if interface is not attached */
833 if (txq >= numqueues)
834 goto drop;
835
> 836 if (numqueues == 1 && static_key_false(&rps_needed)) {
837 /* Select queue was not called for the skbuff, so we extract the
838 * RPS hash and save it into the flow_table here.
839 */
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
[-- Attachment #2: .config.gz --]
[-- Type: application/octet-stream, Size: 44887 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH net-next] tuntap: calculate rps hash only when needed
2016-04-26 1:55 [PATCH net-next] tuntap: calculate rps hash only when needed Jason Wang
2016-04-26 2:30 ` kbuild test robot
@ 2016-04-26 3:12 ` Jason Wang
1 sibling, 0 replies; 3+ messages in thread
From: Jason Wang @ 2016-04-26 3:12 UTC (permalink / raw)
To: davem, netdev, linux-kernel; +Cc: Michael S. Tsirkin
On 04/26/2016 09:55 AM, Jason Wang wrote:
> There's no need to calculate rps hash if it was not enabled. So this
> patch export rps_needed and check it before trying to get rps
> hash. Tests (using pktgen to inject packets to guest) shows this can
> improve pps about 13% (when rps is disabled).
>
> Before:
> ~1150000 pps
> After:
> ~1300000 pps
>
> Cc: Michael S. Tsirkin <mst@redhat.com>
> Signed-off-by: Jason Wang <jasowang@redhat.com>
> ---
> drivers/net/tun.c | 2 +-
> net/core/dev.c | 1 +
> 2 files changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/net/tun.c b/drivers/net/tun.c
> index afdf950..746877f 100644
> --- a/drivers/net/tun.c
> +++ b/drivers/net/tun.c
> @@ -819,7 +819,7 @@ static netdev_tx_t tun_net_xmit(struct sk_buff *skb, struct net_device *dev)
> if (txq >= numqueues)
> goto drop;
>
> - if (numqueues == 1) {
> + if (numqueues == 1 && static_key_false(&rps_needed)) {
> /* Select queue was not called for the skbuff, so we extract the
> * RPS hash and save it into the flow_table here.
> */
> diff --git a/net/core/dev.c b/net/core/dev.c
> index b9bcbe7..d4ba936 100644
> --- a/net/core/dev.c
> +++ b/net/core/dev.c
> @@ -3428,6 +3428,7 @@ u32 rps_cpu_mask __read_mostly;
> EXPORT_SYMBOL(rps_cpu_mask);
>
> struct static_key rps_needed __read_mostly;
> +EXPORT_SYMBOL(rps_needed);
>
> static struct rps_dev_flow *
> set_rps_cpu(struct net_device *dev, struct sk_buff *skb,
Kbuild bot reports an error when !CONFIG_RPS. Will send V2 to fix this.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2016-04-26 3:12 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-04-26 1:55 [PATCH net-next] tuntap: calculate rps hash only when needed Jason Wang
2016-04-26 2:30 ` kbuild test robot
2016-04-26 3:12 ` Jason Wang
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).