Received: by 10.192.165.148 with SMTP id m20csp2451666imm; Sun, 6 May 2018 15:25:46 -0700 (PDT) X-Google-Smtp-Source: AB8JxZr3eprKtSyKGMFyVDUDlxtAeGsoJJ0e/cz141EFBNwqNAveI4UOfYj0F2t1nz+FbMtMwdaW X-Received: by 2002:a63:714d:: with SMTP id b13-v6mr21141047pgn.271.1525645546238; Sun, 06 May 2018 15:25:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525645546; cv=none; d=google.com; s=arc-20160816; b=rnYizylPuuSPzpdiQU5oJfRMIanBhGSP5yAeELCuv0+69ixdefQYSJ2HDPIzMvvpEY amDSBCHd8+s3WUQil5c9X6FuSvpIY6fHvTj8GyaJEWqNnIsFggZfOJQnThB2WolgeDj6 8IO18QvSZaSCNBuJIpe2sRX5WBNHEPRkt9uKHHe4AXFoeL3AOP9lPyaE1zNfdSp2z4/4 j+CCurfkoP/F2Bge9nCmF+x1vfNpdeHWUgmKfwYqRXSOp+fALnwDi47z8/Bop76bqFkl 5UizeJr4vTpGu/4HAZmGrKaRbkdZw3kk9Xtwz1tE8IUAcwGqiJNlyUvamTFR5KE4kzjD fJqQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:references :in-reply-to:subject:cc:date:to:from:arc-authentication-results; bh=MclqCXNm/17AMuhbdoJJQk8R0u3kguruBSohRSc7gtw=; b=nwGO1Ka6GrCMoEtiypg8IdYO24PMRZk2mv2IMILOcda7nHCFH2PrAyCHyagC1gh/+P OVtlgaPFENk2VM3g7zVrDNCMOvb49PtPsB/or/hJq9x2/1xaeDdeBaM260BdldDmIwuM IF7WyafbEgzTk5YA52+rYF5/Bk9NTdEyAUSl1Jt7uy/dPE8VKVlHQfT2m6RVoG5TzxEo N86snlCJPBKGZpbDX1T40gCosb2yvJG+FdeKO/bSM2FhSTw/nexWnDRN8mLWhw/K29Zf l6wdYZeu5uObBrVjuiRcfl4PkmFEulzZJAVoaxdAoeQmfVysEf0ngwAOxyu8rIir/DR9 XR6g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g125-v6si16769302pgc.568.2018.05.06.15.25.01; Sun, 06 May 2018 15:25:46 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751906AbeEFWYv (ORCPT + 99 others); Sun, 6 May 2018 18:24:51 -0400 Received: from mx2.suse.de ([195.135.220.15]:38442 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751854AbeEFWYu (ORCPT ); Sun, 6 May 2018 18:24:50 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id B0FB3ABEC; Sun, 6 May 2018 22:24:48 +0000 (UTC) From: NeilBrown To: Herbert Xu Date: Mon, 07 May 2018 08:24:41 +1000 Cc: Thomas Graf , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 8/8] rhashtable: don't hold lock on first table throughout insertion. In-Reply-To: <20180506052000.7yehd5lke3smccoj@gondor.apana.org.au> References: <152540595840.18473.11298241115621799037.stgit@noble> <152540605444.18473.9591316658457316578.stgit@noble> <20180505094117.pl7b6bbk6mtyri6d@gondor.apana.org.au> <87sh75dapa.fsf@notabene.neil.brown.name> <20180506052000.7yehd5lke3smccoj@gondor.apana.org.au> Message-ID: <878t8wcthy.fsf@notabene.neil.brown.name> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha256; protocol="application/pgp-signature" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --=-=-= Content-Type: text/plain Content-Transfer-Encoding: quoted-printable On Sun, May 06 2018, Herbert Xu wrote: > On Sun, May 06, 2018 at 08:00:49AM +1000, NeilBrown wrote: >> >> The insert function must (and does) take the lock on the bucket before >> testing if there is a "next" table. >> If one inserter finds that it has locked the "last" table (because there >> is no next) and successfully inserts, then the other inserter cannot >> have locked that table yet, else it would have inserted. When it does, >> it will find what the first inserter inserted.=20 > > If you release the lock to the first table then it may be deleted > by the resize thread. Hence the other inserter may not have even > started from the same place. This is true, but I don't see how it is relevant. At some point, each thread will find that the table they have just locked for their search key, has a NULL 'future_tbl' pointer. At the point, the thread can know that the key is not in any table, and that no other thread can add the key until the lock is released. Thanks, NeilBrown --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEG8Yp69OQ2HB7X0l6Oeye3VZigbkFAlrvgKkACgkQOeye3VZi gbkLDw//TvMvimllwjiXIkjbhl3hsROMlfyq1cKaTx7iWNo65CbDfHKCmdu/DbPB BufXaX1tDZ+pe1WwnongVRboVXFHWg2g8N0Do0p+pxNe50y9dUjQbVeIS5fZeYuf akD+RwPScdJudBBDP01ppYzm2QWKa/kxRoLtqE1tMXUJDQ8F4JNaDxKTLs/ZvRK8 VWHX0i5qxmzFKmychTKU7nd2HVO3rSCVEhi5qU0Yl/N0Fkbrxg4rjxTTi+IQlalq 4GNHJtFaiWW/p5tcyvl+Za9lVZ5DRA4sQYwp/gP5FKU0r64ozjQBJ70mMANXiu+8 gsHNltzoyERsuUaFEfIdHF0X3R6OJLD8b5Gs6iQgdKscd6B0HrOetdYQD30MWAaz Frlo4fjfrMfH/WBeTkAava0M2UYNH77klz2TUP0D9lD8NHrgDY6dJs7gGkcxfNr/ uz3CYfHScFveqAsMBiMSfrXcuvQWVsvqKHnkIyexiMyM5eabSYfLEqtE8x9dfekb iQ/foXVNxJXqlVwJfPKQZbrEsvvbnfhhFy+g6gBOeU6j3huSUe/x1BXfe1nCm7i2 usQJ0JSaGnBzb0nGK13DayLZ9a0QVNkPG1CrUd4qKBksWv1e23XZVsI9bN6smp4P GETvFBcP+wdq+6cQ/9SNxC92LOwxFb+8CvQmOeyEpAaA+BU7uFA= =6wNb -----END PGP SIGNATURE----- --=-=-=--