From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Nambiar, Amritha" 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 Message-ID: <2b43b6c9-502d-eabd-cbca-5a8e8b41e5f6@intel.com> References: <152994950582.9733.3330634251364177102.stgit@anamhost.jf.intel.com> <152994988080.9733.10385317895413246222.stgit@anamhost.jf.intel.com> <90d56882-26a9-0a6e-414b-02bd777c2854@intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Cc: Network Development , David Miller , Alexander Duyck , "Samudrala, Sridhar" , Alexander Duyck , Eric Dumazet , Hannes Frederic Sowa , Tom Herbert To: Willem de Bruijn Return-path: Received: from mga04.intel.com ([192.55.52.120]:16386 "EHLO mga04.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751155AbeF1As4 (ORCPT ); Wed, 27 Jun 2018 20:48:56 -0400 In-Reply-To: Content-Language: en-US Sender: netdev-owner@vger.kernel.org List-ID: 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.