Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp1704878yba; Tue, 2 Apr 2019 14:12:04 -0700 (PDT) X-Google-Smtp-Source: APXvYqxvwK5F3P2u0JjuaHXzY6GzEg29tOeEFEsj0/NvGmjWYsrzhFLENdjQm5jSpP/dXliaEoH2 X-Received: by 2002:a65:538b:: with SMTP id x11mr67522953pgq.35.1554239524360; Tue, 02 Apr 2019 14:12:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1554239524; cv=none; d=google.com; s=arc-20160816; b=REtMg0Eg5sBI02QI09/FqnATLi8bUbj3X9VA+QxiSrBkO2pXn2oOG1DTUXTXj0uN0E JkCtZm/0QsLJXEuzSFX53Om9P45ZNvo5mdS4iHykM6pQM/kUy4WzlewZ5aKrG4Z62psU +N7IjzPLf6ZNAceA0FPybz7cHWlVGObnazo9Ey1Y7RkPpg05kCJes4Kni+x0FQFtO4Mu bGS1/DogqhdWeVe0t/dQrVdxAAWdtlYc1b2xJHF7nNf0SHdXMU/u9LVIRgWw5sKCUJZ+ 0KMoP/IffQiUKSiivH4JoLnBC19tZA/HZCwnTE769HNSR/VOS+Jia0QrE4IiiBiorAWs 1jtQ== 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; bh=YsIiacjbr05wUasCTWGd9KPidSz0lrgksiifLEKZlbI=; b=hvfztCdoiDUUW7HlPK97reFNtF0ti2Ms3Gbfx2HhFFoOvfjKoryeMOPodXyy2rhjBf gid/p8vpjm+gTacu0Xl5R9ws6ERxzTeDCQ891mQYWzyJcUsrNCtNujx79tDF9ufMowAp jQLRX9Fc9Frd5xZewH56SWBm8DXud4yinIn2zknwOsKdQM2/OCfDC1X66SB+mSkapFJ1 azqkH4MnCp6CddwFzph6HlfAtjm6zjUzbSD7MwxSgJ4SbRsXOKdJUQNPPlyLGRT5sqmV LcsDIjUXiPhuYPnXV3fBOR6WeF/b9L+c+5Zc+zfKhRnnrQPDObKSkfxxLef/zRoHcBFu 2hag== 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 g33si7955160pgb.192.2019.04.02.14.11.46; Tue, 02 Apr 2019 14:12:04 -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 S1726496AbfDBVKm (ORCPT + 99 others); Tue, 2 Apr 2019 17:10:42 -0400 Received: from mx2.suse.de ([195.135.220.15]:45692 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725822AbfDBVKm (ORCPT ); Tue, 2 Apr 2019 17:10:42 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id BADAEAFF1; Tue, 2 Apr 2019 21:10:40 +0000 (UTC) From: NeilBrown To: David Laight , Thomas Graf , Herbert Xu Date: Wed, 03 Apr 2019 08:10:32 +1100 Cc: "netdev\@vger.kernel.org" , "linux-kernel\@vger.kernel.org" Subject: RE: [PATCH 3/4] rhashtable: use bit_spin_locks to protect hash bucket. In-Reply-To: <87470518ac3f4ab28918917401b9313b@AcuMS.aculab.com> References: <155416000985.9540.14182958463813560577.stgit@noble.brown> <155416006521.9540.5662092375167065834.stgit@noble.brown> <87470518ac3f4ab28918917401b9313b@AcuMS.aculab.com> Message-ID: <87o95o15br.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 Tue, Apr 02 2019, David Laight wrote: > From: NeilBrown >> Sent: 02 April 2019 00:08 >>=20 >> This patch changes rhashtables to use a bit_spin_lock on BIT(1) of the >> bucket pointer to lock the hash chain for that bucket. > ... >> To enhance type checking, a new struct is introduced to represent the >> pointer plus lock-bit >> that is stored in the bucket-table. This is "struct rhash_lock_head" >> and is empty. A pointer to this needs to be cast to either an >> unsigned lock, or a "struct rhash_head *" to be useful. >> Variables of this type are most often called "bkt". > > Did you try using a union of the pointer and an 'unsigned long' ? > Should remove a lot of the casts. It might, but I'm not sure it is what we want. The value is not an unsigned long OR a pointer, it is both blended together. So it really isn't a union. We *want* it to require casts to access, so that it is clear that something unusual is happening, and care is needed. Thanks, NeilBrown --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEG8Yp69OQ2HB7X0l6Oeye3VZigbkFAlyjz8gACgkQOeye3VZi gbkAlQ//eaU5fojN0BZ6unudrklu89WQ6d4MmfliwLbZpahNujvHkwAJHO/6y20R zVWJbijnfv3XO1GSax1ACanUCEo6kePhmaKCX11hCnrRf74tWUakBKMBj0+67xQJ TPJAaGrv1s7Ul6gnhI76clDiwzkBfA4AKbY/k2NyRfeNWksHbBHdX//Wl8JkjHms HtmuZcLxSo/UPgcZBldMyT05FTm1axOvlzWU9d0HveXtImcN3tP3WZoq0TS69iIw Z4QRRhEFReTJIQftJisL4lM8cu7PANE1VEHIjZctizzNb2Unxl/2jypaOhRMpVsu peZ89Nk7ZHd57Jz7aKyQoiA6rieESUWVbF5VtrppqbkJFIzF8n7bu0Rk0WisE5Co Y+GihfSrpXQn6csKIjATP296nyji51tjzVMHIZZNJ3preTXAFCNAIC9GM3FGTKvL 9rpbBm1dWqfXwRWp7ur7rTE959cQg1YVKQjiGn/1AtlVORVe55UwRkJcL4bkU6R/ t9kb12KI7sgIYZbTdtXD6LOakXMV9q4XxPWN9uBw9YOW8J4aYnZC0/eQdmHayLWS Cnrwl1wUeB9b5fZuNIRwxoSOtzpK9XD/d2qPRc1EShxnUKgoY84X8tnvWrvQVsZ0 cY40Lk/vLflIyPvmSSmwnxMgPh3IN6U/OQtg3bYPjiaDcUio/Ig= =PXwp -----END PGP SIGNATURE----- --=-=-=--