From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752494AbcERIWI (ORCPT ); Wed, 18 May 2016 04:22:08 -0400 Received: from mx1.redhat.com ([209.132.183.28]:46343 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752103AbcERIWD (ORCPT ); Wed, 18 May 2016 04:22:03 -0400 Date: Wed, 18 May 2016 11:21:59 +0300 From: "Michael S. Tsirkin" To: Jesper Dangaard Brouer Cc: Jason Wang , davem@davemloft.net, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH net-next] tuntap: introduce tx skb ring Message-ID: <20160518112045-mutt-send-email-mst@redhat.com> References: <1463361421-4397-1-git-send-email-jasowang@redhat.com> <20160516070012-mutt-send-email-mst@redhat.com> <57397C2B.7000603@redhat.com> <20160516105434-mutt-send-email-mst@redhat.com> <573A761D.8080909@redhat.com> <20160518101631.368e3447@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20160518101631.368e3447@redhat.com> X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Wed, 18 May 2016 08:22:02 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, May 18, 2016 at 10:16:31AM +0200, Jesper Dangaard Brouer wrote: > > On Tue, 17 May 2016 09:38:37 +0800 Jason Wang wrote: > > > >> And if tx_queue_length is not power of 2, > > >> we probably need modulus to calculate the capacity. > > > Is that really that important for speed? > > > > Not sure, I can test. > > In my experience, yes, adding a modulus does affect performance. How about simple if (unlikely(++idx > size)) idx = 0; > > > > Right, this sounds a good solution. > > Good idea. I'm not that sure - it's clearly wasting memory. > -- > Best regards, > Jesper Dangaard Brouer > MSc.CS, Principal Kernel Engineer at Red Hat > Author of http://www.iptv-analyzer.org > LinkedIn: http://www.linkedin.com/in/brouer