Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp3918721img; Mon, 25 Mar 2019 22:28:20 -0700 (PDT) X-Google-Smtp-Source: APXvYqxv6TW7VtQXuAqz39hzr3iFl3t3san8v7MvlEYXmGDZqxnMAAXHuscTM6/y9NUZZjj1ZaPv X-Received: by 2002:a62:12c9:: with SMTP id 70mr24138196pfs.156.1553578100174; Mon, 25 Mar 2019 22:28:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553578100; cv=none; d=google.com; s=arc-20160816; b=xvZ6vC6V6TBrBXq9EqUONhff7aQ2KG9w3KiVC6r9OchLm9XFhXCcDqipIAIKoBx8IC N8+RSRwYp/TNFzoqLFlMo3xd8v3gj+Uf3drhOAWC+iOA4Kt9mAECar2vCjTLhU2wohi/ 392DC6N8zA1P/gvqo1T1zduXfoMJRsKXQYoAxQrqnVBd09ifjwAKZPJ1eq5VpAb297L3 41a8zJL1GGoezfrxYXPOFSodEUcL1sJvepTkJRY7mqxoo/EmGcsq8HxjTRXps4sa9zvE W1YhvmbDoAuscqdl5oyAJlpWZMxwDuJOvzmo4ibQM6A5FJcs7tH+Y6foKLA6nypUuD8t zcog== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=J8o3ByitqDIEvsIcY3nTeFxVLRudatB2qp9rPP2CGTU=; b=TrJBm8lSVrXXQ4bM7r4t2Jt2Fr+kvHLNC059u0EjrmNDklGP+/aZ04Rv9Vb/Ebk463 8Uq3gEXa/uBdwxGCOWbWPy30YPX8RHx/fmE/HOcSxuyoie/nLLnQ6+69dpy/hhnsHyIf cc3XXpXMXHLKKsJgryuCOEwmce6lEwDeclNdoZGBhOhaSbHzEaGM5lBb5HIgtOju0eCN jld91MKw0bLH/QEj8VyZtRo2O0jFdfc/WF+rQDs+WetqwFrQsWQf3DADyhWJLE29SCZi lGucd7EY+AlQFXinCxRYQ9TGM273IxsdA8shlZdiJ9oElUFGmVGy64n4rt8Oy3Gzob8G rqpg== 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 d4si15348652pgk.501.2019.03.25.22.28.04; Mon, 25 Mar 2019 22:28:20 -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 S1726299AbfCZF1Z (ORCPT + 99 others); Tue, 26 Mar 2019 01:27:25 -0400 Received: from orcrist.hmeau.com ([104.223.48.154]:59214 "EHLO deadmen.hmeau.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725308AbfCZF1Z (ORCPT ); Tue, 26 Mar 2019 01:27:25 -0400 Received: from gondobar.mordor.me.apana.org.au ([192.168.128.4] helo=gondobar) by deadmen.hmeau.com with esmtps (Exim 4.89 #2 (Debian)) id 1h8ecH-00059s-R1; Tue, 26 Mar 2019 13:27:17 +0800 Received: from herbert by gondobar with local (Exim 4.89) (envelope-from ) id 1h8ecE-0001z1-7t; Tue, 26 Mar 2019 13:27:14 +0800 Date: Tue, 26 Mar 2019 13:27:14 +0800 From: Herbert Xu To: NeilBrown 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. Message-ID: <20190326052714.rqxuiqumjnw2qtb6@gondor.apana.org.au> References: <155349021177.1111.15681654355431465791.stgit@noble.brown> <155349033961.1111.18247269615646768227.stgit@noble.brown> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <155349033961.1111.18247269615646768227.stgit@noble.brown> User-Agent: NeoMutt/20170113 (1.7.2) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. Thanks, -- Email: Herbert Xu Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt