Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp4821669img; Tue, 26 Mar 2019 18:11:28 -0700 (PDT) X-Google-Smtp-Source: APXvYqy27T87Te/inpRF26v54yyo9vEUPsLE+jS762Gat/uar3ml+y150uP3X1fbwYjDZMvT5VZV X-Received: by 2002:a17:902:2989:: with SMTP id h9mr34243950plb.26.1553649087929; Tue, 26 Mar 2019 18:11:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553649087; cv=none; d=google.com; s=arc-20160816; b=alBoaM7J0xHFvFIM5T7IzEE40j1Ei+aaOn/6HfL2Q+PgwG7mh53L3Gi2aquAPeJzgq L/J72QxDR8hZtKbDtjblE1asbWNgHWeDDbSlpzcdB3JEwCD/AwcfuC0t6jIgK/HvgiId Ieva4kHquXLipoFmjLSSpyNICukWM/TikZRmu2RQ4NTipzxoBCcscPs5fhKblMV+QxbR UYJOGNotrD9bQS74qWUd6umy9aiGRsOIDc8YY6azc69EMSLRVvGSyi2nS5sh8cZstiAV IHCvo3OnwWy7bCwnrjGejCDYn+VWraGRKczaSTyDOckNDmDQmoWv2VIiuavz0QbbnBHi BoXA== 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=BF7DQDHw2hgTeyroJ4jz6i490ZC7hZYa9MQDH1vGm1Q=; b=ZY6ptiMyFmDTZc5LXBiZr5agYOJZPCOk1DQ9xFoaSppfWE/4jJz8uY2foucptGLllk Z27wuDGAA1QZXDskIgk5SqGhrSDeeEOvq/kzUJO+RNbGjZz05EOtK6pulC+JMQ0b+vUZ AU3mcF9rocT6JpRTfIOYofWJt2CFpM0611TEUoivZdEMBSutaHSGooZRnNVLhEU1WsmZ Gp8yHQe6FcZgBPUdIbjMH/VBLLXC4OnsfvwPIBiUL4D4CFgmk9hEWWg+kX91FvcA5gez QRW1i1yMDvlLiqn9l5MmgoRgvNJl86IXLQPjcsIZd2wySMcSwfWmq32zBDzdnMiHlut2 uTpg== 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 p10si8998296plr.137.2019.03.26.18.11.12; Tue, 26 Mar 2019 18:11:27 -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 S1732371AbfC0BKT (ORCPT + 99 others); Tue, 26 Mar 2019 21:10:19 -0400 Received: from mx2.suse.de ([195.135.220.15]:57944 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1731613AbfC0BKT (ORCPT ); Tue, 26 Mar 2019 21:10:19 -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 BD271ACA9; Wed, 27 Mar 2019 01:10:17 +0000 (UTC) From: NeilBrown To: Herbert Xu Date: Wed, 27 Mar 2019 09:40:14 +1100 Cc: Thomas Graf , 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: <20190326052714.rqxuiqumjnw2qtb6@gondor.apana.org.au> References: <155349021177.1111.15681654355431465791.stgit@noble.brown> <155349033961.1111.18247269615646768227.stgit@noble.brown> <20190326052714.rqxuiqumjnw2qtb6@gondor.apana.org.au> Message-ID: <871s2t45v5.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 Tue, Mar 26 2019, Herbert Xu wrote: > On Mon, Mar 25, 2019 at 04:05:39PM +1100, NeilBrown wrote: >> >> +/* >> + * If 'p' is a bucket head and might be locked: >> + * rht_ptr() returns the address without the lock bit. >> + * rht_ptr_locked() returns the address WITH the lock bit. >> + * rht_is_locked() tests if the lock bit is set. >> + */ >> +static inline struct rhash_head __rcu *rht_ptr(const struct rhash_head *p) >> +{ >> + return (void *)(((unsigned long)p) & ~2UL); >> +} > > My preference would be to turn rhash_head * into an opaque type > that can only be dereferenced through rht_ptr. I can try that. Presumably the 'next' pointer in 'struct rhash_head' can still be a normal pointer, but the buckets in the bucket_table would need to opaque pointers. Maybe pointers to some new undefined struct, which gets cast and masked as appropriate? I'll have a go and see how it looks. Thanks, NeilBrown --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEG8Yp69OQ2HB7X0l6Oeye3VZigbkFAlyaqk8ACgkQOeye3VZi gbkErg/+MbqjrBVffvthmuRxdzi0oYvphANBMI2mLi9aGTNEegabeI9MMPlHcvSb Y3DeKgoZbFeihHVQl3IUXrO3o2mpAv1SEIKs1y2wulLP5gl1PgAO+b0NPhcxg+QU v65G0Rxzd+enRHz3/FbYzajnEjAGPyi2koSj/8MUOaIQjrPaN8y9qPLu09CPoHg8 UTwwxtdLMyxPfCX0g8KkFhBphYBpZJN/JKJfIeFglIJONQfvtlwEvxt+Xhadwnu9 pfiCH59CmfqX013ZbXbumv1rCwdiBD1nwlZH4SdnHoa0evB3jMQjcM9QiIom0D2g kOQB+ucwJ53jaRGh02KWCG8YvhQpKy8c/IIwO8QS/Kkdfcazq4SiYj/umx2aKDxQ ifhlhhfXVuKeZi52to+rSDmuzO8otS3xUKyuYvwFcjxj9ryRyx7KD8k+m9KCgpD3 l35Z7aPIqBGEO4IPlaepg+uk7nVnDPDIF2isXoKmdXj0KZyAUaDHrzfO8K55xa4S yMqHgvz0CfPYVlzVcFn9P65pzy25tuyQDe0XHe9/9aIXqpjJ0QB2cHQAQd3vXVql GWtwhq29AOQKijYedPms/mZ92YJ6OIJmxjbbAGTUiZ3tevi7A/pPeZ46Rv84nvLJ dhtZLZX7WKc6q2qj6meC9u7YmEvbGLNCTvW51o5YF4ga+d9bv4k= =WHNE -----END PGP SIGNATURE----- --=-=-=--