From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757455AbcCaUBS (ORCPT ); Thu, 31 Mar 2016 16:01:18 -0400 Received: from shards.monkeyblade.net ([149.20.54.216]:58373 "EHLO shards.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752578AbcCaUBR (ORCPT ); Thu, 31 Mar 2016 16:01:17 -0400 Date: Thu, 31 Mar 2016 16:01:15 -0400 (EDT) Message-Id: <20160331.160115.1737831060132252055.davem@davemloft.net> To: eric.dumazet@gmail.com Cc: jasowang@redhat.com, mst@redhat.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH net-next 1/6] net: skbuff: don't use union for napi_id and sender_cpu From: David Miller In-Reply-To: <1459420341.6473.225.camel@edumazet-glaptop3.roam.corp.google.com> References: <1459403439-6011-1-git-send-email-jasowang@redhat.com> <1459403439-6011-2-git-send-email-jasowang@redhat.com> <1459420341.6473.225.camel@edumazet-glaptop3.roam.corp.google.com> X-Mailer: Mew version 6.6 on Emacs 24.5 / Mule 6.0 (HANACHIRUSATO) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.5.12 (shards.monkeyblade.net [149.20.54.216]); Thu, 31 Mar 2016 13:01:16 -0700 (PDT) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Eric Dumazet Date: Thu, 31 Mar 2016 03:32:21 -0700 > On Thu, 2016-03-31 at 13:50 +0800, Jason Wang wrote: >> We use a union for napi_id and send_cpu, this is ok for most of the >> cases except when we want to support busy polling for tun which needs >> napi_id to be stored and passed to socket during tun_net_xmit(). In >> this case, napi_id was overridden with sender_cpu before tun_net_xmit() >> was called if XPS was enabled. Fixing by not using union for napi_id >> and sender_cpu. >> >> Signed-off-by: Jason Wang >> --- >> include/linux/skbuff.h | 10 +++++----- >> 1 file changed, 5 insertions(+), 5 deletions(-) >> >> diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h >> index 15d0df9..8aee891 100644 >> --- a/include/linux/skbuff.h >> +++ b/include/linux/skbuff.h >> @@ -743,11 +743,11 @@ struct sk_buff { >> __u32 hash; >> __be16 vlan_proto; >> __u16 vlan_tci; >> -#if defined(CONFIG_NET_RX_BUSY_POLL) || defined(CONFIG_XPS) >> - union { >> - unsigned int napi_id; >> - unsigned int sender_cpu; >> - }; >> +#if defined(CONFIG_NET_RX_BUSY_POLL) >> + unsigned int napi_id; >> +#endif >> +#if defined(CONFIG_XPS) >> + unsigned int sender_cpu; >> #endif >> union { >> #ifdef CONFIG_NETWORK_SECMARK > > Hmmm... > > This is a serious problem. > > Making skb bigger (8 bytes because of alignment) was not considered > valid for sender_cpu introduction. We worked quite hard to avoid this, > if you take a look at git history :( > > Can you describe more precisely the problem and code path ? >>From what I can see they are doing busy poll loops in the TX code paths, as well as the RX code paths, of vhost. Doing this in the TX side makes little sense to me. The busy poll implementations in the drivers only process their RX queues when ->ndo_busy_poll() is invoked. So I wonder what this is accomplishing for the vhost TX case?