Received: by 10.192.165.148 with SMTP id m20csp2436840imm; Sun, 6 May 2018 15:03:06 -0700 (PDT) X-Google-Smtp-Source: AB8JxZph/B+N06a+TDNX4WfVvOC1Ey6kwTC63fLjNgHREAbtLS3ZNXoecvpU9Oqt2zBn97UUl6vS X-Received: by 2002:a17:902:2927:: with SMTP id g36-v6mr35582872plb.303.1525644186128; Sun, 06 May 2018 15:03:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525644186; cv=none; d=google.com; s=arc-20160816; b=vdCsTa8NmSeoxToZEGv2EbX1Ib90NWXvFOKQ3yREebrVPcvJ5Eocn3HZZM1r/o46fY nXGko6+4ua1D+vnjrnMOubqLLHMk7MbdHxqA+Y4oN5imjvJmYMhx2f8PtINeZxyyprXN 0fztyPD/eKWZkLSHVRRKFybgULiueOXX0QSOeed1EeWZ6QE9ieW3MG962VUYaVG2TOda FHPI+46d/WXvGg/ar1v2IvobKJT3x1WDQ8NQD2I9JiAD+PjsltDacfu5+p5Oze3KKaBc r9EttcA85/+DLww3mrurEe5ybILBYRz9YVhJqAfkhGVt57u+mZfGeQtQR64QETY0Hfcq EYKQ== 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=qGItWHv06OzeGl8XSrrs+kqgLAYJFhKaR8wRUkpsIjw=; b=hLkoVu8IOyeMPgF3Ul1PftkPJzThERdLv+eK7gGVMmDA8ZIDTSp9xma/vMnox0rILa Ck051OGzX7kz0BbhqOkWEpKqAuLIQsKV0PNG+pwNJRzZaobGKQSc0QsQafXj2aKLBQKz NqsGP8yn0eLcqjCgqQpsedhvn+PLkhwJha9zPXh8X0NHd6g+4B08HW/pwIvRYhL6fdLk fma8TE5fD8mNtFhbY09JZDXcR/Nn0Y2HF/qbTfPlG83QRSW+0DOjov37dzZiftczrB9j D9K0ET889C05XZuLWGO/DwPO43vNW3c62LhA+wGzmwB+ddph4cpirAQS1NeMtJ5uDtwC bLpA== 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 n34-v6si20682490pld.91.2018.05.06.15.02.38; Sun, 06 May 2018 15:03:06 -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 S1751886AbeEFWCW (ORCPT + 99 others); Sun, 6 May 2018 18:02:22 -0400 Received: from mx2.suse.de ([195.135.220.15]:36748 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751834AbeEFWCU (ORCPT ); Sun, 6 May 2018 18:02:20 -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 57FBDAF3E; Sun, 6 May 2018 22:02:19 +0000 (UTC) From: NeilBrown To: Herbert Xu Date: Mon, 07 May 2018 08:02:12 +1000 Cc: Thomas Graf , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 4/8] rhashtable: fix race in nested_table_alloc() In-Reply-To: <20180506051859.w7evarps5jdcplz6@gondor.apana.org.au> References: <152540595840.18473.11298241115621799037.stgit@noble> <152540605432.18473.11813271279255176724.stgit@noble> <20180505092907.2qa3scf6bzvubmtt@gondor.apana.org.au> <871sepepuj.fsf@notabene.neil.brown.name> <20180506051859.w7evarps5jdcplz6@gondor.apana.org.au> Message-ID: <87efiocujf.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 On Sun, May 06 2018, Herbert Xu wrote: > On Sun, May 06, 2018 at 07:48:20AM +1000, NeilBrown wrote: >> >> The spinlock protects 2 or more buckets. The nested table contains at >> least 512 buckets, maybe more. >> It is quite possible for two insertions into 2 different buckets to both >> get their spinlock and both try to instantiate the same nested table. > > I think you missed the fact that when we use nested tables the spin > lock table is limited to just a single page and hence corresponds > to the first level in the nested table. Therefore it's always safe. Yes I had missed that - thanks for pointing it out. In fact the lock table is limited to the number of nested_tables in the second level. And it is the same low-order bits that choose both the lock and the set of nested tables. So there isn't a bug here. So we don't need this patch. (I still like it though - it seems more obviously correct). Thanks, NeilBrown --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEG8Yp69OQ2HB7X0l6Oeye3VZigbkFAlrve2QACgkQOeye3VZi gbkMCxAAm2hfOMPSiAjkEAZQZQjATdTzoAAw070cBg453zjC3PDFn5ULoci06ZMF CBJBEsZ82Dsh0N0jwV6XxsCuwhfWSNkTIDkKzB9uBOAA/biVZan0SQCWKP0a1UQc GLoEDBzKGDuxbuwTlr1fAUC4xj/oO8jgFVMtVItMculpnO0QCWFpPMWFnHhGsACf 2T0NmJalDkcEU55NVY6h7pqMKPd3Lo+pEXI9jMoX8C+Nn58bCwuWcR7fZNNncF7e W6gcu33QIZqN99VzTZV+cqQSz537gVp5wpR9YAhDuyziYZ80JZi17dOf8/lks5FJ GGoU+D0wKJAy8MvjHu854Xw8ZD5mSCOvmVuCSoIXH5l4kdl0UBRNUhp4I3+/UeOt pJ4/rPdwk+KDZ2BlfR/gcAvaMcmsVcy0bCuW1xMjQ+uklxqvniJWeuH32Mal5vqU GvCGlTpNl8zZmnqiu5dbQ6afn9gFXX1aFidpMX/ResrU6nhotavrAyII/lu4QLK+ G/HKv0+j16W3yANR1grFK89JoBgprVUVewYy5yNKXruLi8stsONtq36G2SqFv1B8 DRcDUxHCEdoSGcWHTht+WX4i4HzpVY5knDPNuhSiyAhDG1XUfk+K4P4ldiJh52p2 U5iZp6CzHFiZjJzIBcjQEBRcCkw705GabbdiCACEPgOycK+Zs1A= =j0az -----END PGP SIGNATURE----- --=-=-=--