Netdev List
 help / color / mirror / Atom feed
From: "Nambiar, Amritha" <amritha.nambiar@intel.com>
To: Willem de Bruijn <willemdebruijn.kernel@gmail.com>
Cc: Network Development <netdev@vger.kernel.org>,
	David Miller <davem@davemloft.net>,
	Alexander Duyck <alexander.h.duyck@intel.com>,
	"Samudrala, Sridhar" <sridhar.samudrala@intel.com>,
	Alexander Duyck <alexander.duyck@gmail.com>,
	Eric Dumazet <edumazet@google.com>,
	Hannes Frederic Sowa <hannes@stressinduktion.org>,
	Tom Herbert <tom@herbertland.com>
Subject: Re: [net-next PATCH v4 5/7] net: Enable Tx queue selection based on Rx queues
Date: Wed, 27 Jun 2018 17:48:55 -0700	[thread overview]
Message-ID: <2b43b6c9-502d-eabd-cbca-5a8e8b41e5f6@intel.com> (raw)
In-Reply-To: <CAF=yD-Kd4DkC6DWydwiwEZytE9NsnOYZg2KFFxQ8xgAA=DUiXw@mail.gmail.com>

On 6/27/2018 3:47 AM, Willem de Bruijn wrote:
>>>> +static int get_xps_queue(struct net_device *dev, struct sk_buff *skb)
>>>>  {
>>>>  #ifdef CONFIG_XPS
>>>>         struct xps_dev_maps *dev_maps;
>>>> -       struct xps_map *map;
>>>> +       struct sock *sk = skb->sk;
>>>>         int queue_index = -1;
>>>>
>>>>         if (!static_key_false(&xps_needed))
>>>>                 return -1;
>>>>
>>>>         rcu_read_lock();
>>>> -       dev_maps = rcu_dereference(dev->xps_cpus_map);
>>>> +       if (!static_key_false(&xps_rxqs_needed))
>>>> +               goto get_cpus_map;
>>>> +
>>>> +       dev_maps = rcu_dereference(dev->xps_rxqs_map);
>>>>         if (dev_maps) {
>>>> -               unsigned int tci = skb->sender_cpu - 1;
>>>> +               int tci = sk_rx_queue_get(sk);
>>>
>>> What if the rx device differs from the tx device?
>>>
>> I think I have 3 options here:
>> 1. Cache the ifindex in sock_common which will introduce a new
>> additional field in sock_common.
>> 2. Use dev_get_by_napi_id to get the device id. This could be expensive,
>> if the rxqs_map is set, this will be done on every packet and involves
>> walking through the hashlist for napi_id lookup.
> 
> The tx queue mapping is cached in the sk for connected sockets, but
> indeed this would be expensive for many workloads.
> 
>> 3. Remove validating device id, similar to how it is in skb_tx_hash
>> where rx_queue recorded is used and if not, fall through to flow hash
>> calculation.
>> What do you think is suitable here?
> 
> Alternatively, just accept the misprediction in this rare case. But do
> make the caveat explicit in the documentation.
> 
Okay, I will add this in the documentation.

  reply	other threads:[~2018-06-28  0:48 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-25 18:04 [net-next PATCH v4 0/7] Symmetric queue selection using XPS for Rx queues Amritha Nambiar
2018-06-25 18:04 ` [net-next PATCH v4 1/7] net: Refactor XPS for CPUs and " Amritha Nambiar
2018-06-26 22:53   ` Tom Herbert
2018-06-28  0:47     ` Nambiar, Amritha
2018-06-25 18:04 ` [net-next PATCH v4 2/7] net: Use static_key for XPS maps Amritha Nambiar
2018-06-26 22:54   ` Tom Herbert
2018-06-25 18:04 ` [net-next PATCH v4 3/7] net: sock: Change tx_queue_mapping in sock_common to unsigned short Amritha Nambiar
     [not found]   ` <CALx6S37uFs1shuPmno+L=p_Hyy1Q2qNaK+AqYvrk4HXTApL_Vg@mail.gmail.com>
2018-06-26  3:25     ` Alexander Duyck
2018-06-26 23:54       ` Nambiar, Amritha
2018-06-26 10:58   ` Willem de Bruijn
2018-06-27  0:00     ` Nambiar, Amritha
2018-06-25 18:04 ` [net-next PATCH v4 4/7] net: Record receive queue number for a connection Amritha Nambiar
2018-06-25 18:04 ` [net-next PATCH v4 5/7] net: Enable Tx queue selection based on Rx queues Amritha Nambiar
2018-06-26  2:04   ` kbuild test robot
2018-06-26 11:04   ` Willem de Bruijn
2018-06-27  0:36     ` Nambiar, Amritha
2018-06-27 10:47       ` Willem de Bruijn
2018-06-28  0:48         ` Nambiar, Amritha [this message]
2018-06-25 18:04 ` [net-next PATCH v4 6/7] net-sysfs: Add interface for Rx queue(s) map per Tx queue Amritha Nambiar
2018-06-26 10:55   ` Willem de Bruijn
2018-06-27  0:21     ` Nambiar, Amritha
2018-06-25 18:04 ` [net-next PATCH v4 7/7] Documentation: Add explanation for XPS using Rx-queue(s) map Amritha Nambiar
2018-06-26 22:59   ` Tom Herbert

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=2b43b6c9-502d-eabd-cbca-5a8e8b41e5f6@intel.com \
    --to=amritha.nambiar@intel.com \
    --cc=alexander.duyck@gmail.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