From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by dpdk.org (Postfix) with ESMTP id 5C81C9A8D for ; Fri, 13 May 2016 19:10:47 +0200 (CEST) Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga103.jf.intel.com with ESMTP; 13 May 2016 10:10:46 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.24,614,1455004800"; d="scan'208";a="979923234" Received: from irsmsx153.ger.corp.intel.com ([163.33.192.75]) by fmsmga002.fm.intel.com with ESMTP; 13 May 2016 10:10:45 -0700 Received: from irsmsx105.ger.corp.intel.com ([169.254.7.130]) by IRSMSX153.ger.corp.intel.com ([169.254.9.140]) with mapi id 14.03.0248.002; Fri, 13 May 2016 18:10:44 +0100 From: "Ananyev, Konstantin" To: Stephen Hemminger , "Doherty, Declan" CC: "Iremonger, Bernard" , "dev@dpdk.org" Thread-Topic: [dpdk-dev] [PATCH 1/5] bonding: replace spinlock with read/write lock Thread-Index: AQHRpvF5zY5KwBchMEiw1zqtXVzCN5+rpnuAgABaV4CACySCgA== Date: Fri, 13 May 2016 17:10:43 +0000 Message-ID: <2601191342CEEE43887BDE71AB97725836B50971@irsmsx105.ger.corp.intel.com> References: <1462461300-9962-1-git-send-email-bernard.iremonger@intel.com> <1462461300-9962-2-git-send-email-bernard.iremonger@intel.com> <20160505101233.191151ac@xeon-e3> <7f47b47d-945a-c265-4db3-dc0d6850a348@intel.com> <20160506085539.1ece142c@xeon-e3> In-Reply-To: <20160506085539.1ece142c@xeon-e3> Accept-Language: en-IE, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [163.33.239.180] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] [PATCH 1/5] bonding: replace spinlock with read/write lock X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 May 2016 17:10:47 -0000 > -----Original Message----- > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Stephen Hemminger > Sent: Friday, May 06, 2016 4:56 PM > To: Doherty, Declan > Cc: Iremonger, Bernard; dev@dpdk.org > Subject: Re: [dpdk-dev] [PATCH 1/5] bonding: replace spinlock with read/w= rite lock >=20 > On Fri, 6 May 2016 11:32:19 +0100 > Declan Doherty wrote: >=20 > > On 05/05/16 18:12, Stephen Hemminger wrote: > > > On Thu, 5 May 2016 16:14:56 +0100 > > > Bernard Iremonger wrote: > > > > > >> Fixes: a45b288ef21a ("bond: support link status polling") > > >> Signed-off-by: Bernard Iremonger > > > > > > You know an uncontested reader/writer lock is significantly slower > > > than a spinlock. > > > > > > > As we can have multiple readers of the active slave list / primary > > slave, basically any tx/rx burst call needs to protect against a device > > being removed/closed during it's operation now that we support > > hotplugging, in the worst case this could mean we have 2(rx+tx) * queue= s > > possibly using the active slave list simultaneously, in that case I > > would have thought that a spinlock would have a much more significant > > affect on performance? >=20 > Right, but the window where the shared variable is accessed is very small= , > and it is actually faster to use spinlock for that. I don't think that window we hold the lock is that small, let say if we hav= e a burst of 32 packets * (let say) 50 cycles/pkt =3D ~1500 cycles - each IO = thread would stall. For me that's long enough to justify rwlock usage here, especially that=20 DPDK rwlock price is not much bigger (as I remember) then spinlock - it is basically 1 CAS operation. Konstantin =20