From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR04-DB3-obe.outbound.protection.outlook.com (mail-eopbgr60078.outbound.protection.outlook.com [40.107.6.78]) by dpdk.org (Postfix) with ESMTP id 5FF27239 for ; Sat, 10 Nov 2018 19:58:23 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector1-arm-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=+ESn2Qo9NRAGuOUV8x6HHAtWIaLOcKZnG7aISUvHukc=; b=nbuEaClvntv7E60ccqG5Ihm+9pucgefIF07Eahdx08jM4Xd0Ah79PrzhNqMLbgY4OOi2R/dBQ39NC7j8ellIeA0Wck/tUvxa/UwQfyvfzvzlKnixrMxCgwywvF72tdTpiB74RXm1tpFLfwYBr2iCRVFgUMR4DvbG+AvtFDH7dEQ= Received: from AM6PR08MB3672.eurprd08.prod.outlook.com (20.177.115.29) by AM6PR08MB3016.eurprd08.prod.outlook.com (52.135.163.33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1294.21; Sat, 10 Nov 2018 18:58:21 +0000 Received: from AM6PR08MB3672.eurprd08.prod.outlook.com ([fe80::c1a0:51bf:cd33:2b27]) by AM6PR08MB3672.eurprd08.prod.outlook.com ([fe80::c1a0:51bf:cd33:2b27%6]) with mapi id 15.20.1294.042; Sat, 10 Nov 2018 18:58:21 +0000 From: Honnappa Nagarahalli To: Jerin Jacob CC: "bruce.richardson@intel.com" , "pablo.de.lara.guarch@intel.com" , "dev@dpdk.org" , "hemant.agrawal@nxp.com" , "chaozhu@linux.vnet.ibm.com" , "yipeng1.wang@intel.com" , Dharmik Thakkar , "Gavin Hu (Arm Technology China)" , nd , nd Thread-Topic: [PATCH 3/4] hash: remove memory orderings from rw-lock lookup fns Thread-Index: AQHUeErTFUdnjBzv9kCkg6bqE8aAHKVItH2AgACpHpA= Date: Sat, 10 Nov 2018 18:58:21 +0000 Message-ID: References: <20181109163917.16845-1-honnappa.nagarahalli@arm.com> <20181109163917.16845-4-honnappa.nagarahalli@arm.com> <20181110085100.GA14682@jerin> In-Reply-To: <20181110085100.GA14682@jerin> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=Honnappa.Nagarahalli@arm.com; x-originating-ip: [217.140.111.135] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; AM6PR08MB3016; 6:nkxbioF4VJ6fD+uQcSDrmLBuvhagRJi/i02YZWSgKMqpgY9RlGjFa+4wI/7wjVy8i5wQL1SOaUbVlF+PpdmP9M3pnT5fTpq8EjMvZ/0BWD7zlEpU12Yr3pYdgHYQcvAq2VuSElTwiMX4zSYWtw+b7vMvkQLUrlngPNgY7YjdxuxDVO9EH5sKPukeV2xObtTKDVLq5WLhXDmrxITpIU4L9j3Jlg88qhYSuaeqDLPPJzMUn3NWpXRS5xps+etCaRoh9nsMaoaDK4ZZJafX28N+hJlYkKITn618sCfxQ9QR0/ZCI8TyDToXo62clqtbqk7uxV15ZSnszCzDPvvJsOUnkr5xfssvtGgE2EbArynlMdZ08d38wb4a8lcmiC4aDtQEuXBOFbxlWq1ZEdQDcrRmkaMlZm2EDjM+uCgtQhhg1kPRPkXlSAU4DY29Xd6H2F7MZ0R11uRzTakiiHxoYjJTEA==; 5:oSl2dfYJm2maQbuvS8TMZLsV6bCVndznSd9ortLdBVNoPz3o0XHkd7MgOqSUMgc1I7LRGt715F6wXwc5um6RDWIrJPx1YFAFZSXCvSgp7SOhoF4vISla0D7mAxQHTMNv4LFHANH7Q/eeVKu0W27vS/poRcLc+zahdPLlVuViVLo=; 7:U820ZOhl1lkTOhOzXadoXZICf3OSqjYMLH7Ko73iG+8diqsdFq5RYirRO1MmJJkAqJU0ohlE3BRlKP5VahAQiTRIaNnqbE0N9CZcfh8kF8k5aVpFducjQepdKfx97xNEr4F4HO//t7UOctVIQ4ithQ== x-ms-exchange-antispam-srfa-diagnostics: SOS;SOR; x-ms-office365-filtering-correlation-id: 0170523a-f1c1-459e-d45e-08d6473e7c42 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390040)(7020095)(4652040)(8989299)(5600074)(711020)(4618075)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(2017052603328)(7153060)(7193020); SRVR:AM6PR08MB3016; x-ms-traffictypediagnostic: AM6PR08MB3016: nodisclaimer: True x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(163750095850); x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(3002001)(10201501046)(3231382)(944501410)(52105095)(93006095)(93001095)(6055026)(148016)(149066)(150057)(6041310)(20161123558120)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(20161123560045)(20161123562045)(201708071742011)(7699051)(76991095); SRVR:AM6PR08MB3016; BCL:0; PCL:0; RULEID:; SRVR:AM6PR08MB3016; x-forefront-prvs: 0852EB6797 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(376002)(136003)(346002)(366004)(39850400004)(396003)(199004)(189003)(305945005)(5660300001)(55016002)(9686003)(7736002)(74316002)(14444005)(256004)(25786009)(229853002)(6916009)(33656002)(6436002)(97736004)(6116002)(3846002)(53936002)(71200400001)(2906002)(71190400001)(478600001)(68736007)(72206003)(14454004)(66066001)(6246003)(106356001)(105586002)(186003)(26005)(476003)(575784001)(86362001)(4326008)(54906003)(486006)(316002)(99286004)(11346002)(102836004)(8676002)(81156014)(446003)(76176011)(81166006)(7696005)(8936002)(2900100001)(6506007); DIR:OUT; SFP:1101; SCL:1; SRVR:AM6PR08MB3016; H:AM6PR08MB3672.eurprd08.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; received-spf: None (protection.outlook.com: arm.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: 0/7GMFbdVGu/JVxmzL7k0XD/g9id2xGVaaHhiwlcH3/WkCPK4HZG+FRIbCHiPr4zwDK6LYVK5lkmUozAEaJ/VBgdRdP9uXw/kLo5sGC2yuucPdwl3/IE22hj1PZFQMqr1WkwOVx4wS41Wfg2EKAIqMUZ2J9mtM4pLyE6cFttLjQrXwFEvcAJTt0jiTfKuYn/+SX4kbbCgN8kXGU1dpiTGfwZ9cCdRhrfOeQkEdkqOEJqSLtMAcHDGNXrjNlcZtB49i7quoYv1DF+ePf3hRgEBH2OTgDR43sDD9yphdmrlCE/IHvjPIBI3QQHcFUzOAchR+7FAsvofmtcLiwDLCPpKBYEOnacB14qYcxXsQhxWPE= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-Network-Message-Id: 0170523a-f1c1-459e-d45e-08d6473e7c42 X-MS-Exchange-CrossTenant-originalarrivaltime: 10 Nov 2018 18:58:21.7012 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR08MB3016 Subject: Re: [dpdk-dev] [PATCH 3/4] hash: remove memory orderings from rw-lock lookup fns X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 Nov 2018 18:58:23 -0000 > > @@ -1211,49 +1205,25 @@ __rte_hash_lookup_with_hash(const struct > > rte_hash *h, const void *key, > > > > __hash_rw_reader_lock(h); > > > > - do { > > - /* Load the table change counter before the lookup > > - * starts. Acquire semantics will make sure that > > - * loads in search_one_bucket are not hoisted. > > - */ > > - cnt_b =3D __atomic_load_n(h->tbl_chng_cnt, > > - __ATOMIC_ACQUIRE); > > + /* Check if key is in primary location */ > > + bkt =3D &h->buckets[prim_bucket_idx]; >=20 >=20 > In original version, this bkt assignment is before to __hash_rw_reader_lo= ck(). > This causing performance issue in lookup 'hit' case. >=20 > Following change is fixing it.i.e bringing back to orginal version. >=20 > [master]83xx1.2[dpdk]# git diff > diff --git a/lib/librte_hash/rte_cuckoo_hash.c > b/lib/librte_hash/rte_cuckoo_hash.c > index 7e1a9ac96..bc8a55f0f 100644 > --- a/lib/librte_hash/rte_cuckoo_hash.c > +++ b/lib/librte_hash/rte_cuckoo_hash.c > @@ -1204,10 +1204,11 @@ __rte_hash_lookup_with_hash_l(const struct > rte_hash *h, const void *key, > prim_bucket_idx =3D get_prim_bucket_index(h, sig); > sec_bucket_idx =3D get_alt_bucket_index(h, prim_bucket_idx, short= _sig); >=20 > - __hash_rw_reader_lock(h); > - > /* Check if key is in primary location */ > bkt =3D &h->buckets[prim_bucket_idx]; > + > + __hash_rw_reader_lock(h); > + > ret =3D search_one_bucket_l(h, key, short_sig, data, bkt); > if (ret !=3D -1) { > __hash_rw_reader_unlock(h); >=20 >=20 > Could you send the final version that needs to taken into tree. > i.e remove intermediate commits only for review purpose. > I can test it finally with that. Thanks Jerin for testing. I have sent out v2.