Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp810012imm; Fri, 1 Jun 2018 09:55:35 -0700 (PDT) X-Google-Smtp-Source: ADUXVKIvmKkjfCAD52ZUKvm7Q4MdROrMOkWSklaYMXtVjoyj5eZ0biibJsUc2N3lvMG93EmugrNG X-Received: by 2002:a63:6bc7:: with SMTP id g190-v6mr9478630pgc.230.1527872135840; Fri, 01 Jun 2018 09:55:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527872135; cv=none; d=google.com; s=arc-20160816; b=rGSVH5hdPKU+41W89A0/XhwPvXtRzNtPB00gKSsgMlMebnU28FVfNxqeKI83dUEJYE Bsesq2lS/cflQy4dfnlz4YmI4tV4aD42rWicUF7oZuEz8GW6o49G5Q0R4BdszYvkJUJq /4RkRB8pzpKKJcvuJCaM/8pP1yVermHoT2AUQp9Xlwb8RnHr1MUhdSQvM6xECSeRG641 EnSodZz6wfjc+eelmQdSHJwwIChE34AL64nGwQmipIgY/okI2lCikNovH+kqwgCR61+x +u7/cmdnLNdHGuN//C6LBXQdHWV6Ht6tePJO8GS3cqWVw8BkYWZwHorOCSzP3vb3NnHd Cb1A== 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:arc-authentication-results; bh=q8xw5NXfjAPoHZqrBjc2F+OSBgdtTKJUvRrUUdKAW+A=; b=zRtgd16bIfhs7xECQfIeKrUrU/k5MZoZnJ34pSozx3fRlfJhnnyAlXSG4wbxzQHbXp Yya3NnpvSBlAgj9dPw0DTiY/ic8sAEiIWhtwbCmqZAvuxn+72dIR0m68OckWrlH81yvG Sm+X4tFcMZwQYZjPxAJSnXbe7Jorda7L54QrUOlhLG3irX08g9koBX3kQWwPMhmM1L2A RzbZntDn5wItH5haXuFCxLDn15QjKcfw30iu49iebZq3ShcRl5UM0u0octBLpgJUyvk/ QAThDudH78oPrMFIZfnDOBKLIT/jI5OpaXp5DLPMh6PeEALjvKc+D2+y0ykPvB4Kxwz5 6HjA== 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 z64-v6si31885212pgb.471.2018.06.01.09.55.21; Fri, 01 Jun 2018 09:55:35 -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 S1753490AbeFAQyk (ORCPT + 99 others); Fri, 1 Jun 2018 12:54:40 -0400 Received: from orcrist.hmeau.com ([104.223.48.154]:58094 "EHLO deadmen.hmeau.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753175AbeFAQyf (ORCPT ); Fri, 1 Jun 2018 12:54:35 -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 1fOnJu-0005jH-E9; Sat, 02 Jun 2018 00:54:30 +0800 Received: from herbert by gondobar with local (Exim 4.89) (envelope-from ) id 1fOnJs-0001PM-I6; Sat, 02 Jun 2018 00:54:28 +0800 Date: Sat, 2 Jun 2018 00:54:28 +0800 From: Herbert Xu To: NeilBrown Cc: Thomas Graf , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 08/18] rhashtable: clean up dereference of ->future_tbl. Message-ID: <20180601165428.gtefyay2dlus754p@gondor.apana.org.au> References: <152782754287.30340.4395718227884933670.stgit@noble> <152782824957.30340.14092720576731091742.stgit@noble> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <152782824957.30340.14092720576731091742.stgit@noble> 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 Fri, Jun 01, 2018 at 02:44:09PM +1000, NeilBrown wrote: > Using rht_dereference_bucket() to dereference > ->future_tbl looks like a type error, and could be confusing. > Using rht_dereference_rcu() to test a pointer for NULL > adds an unnecessary barrier - rcu_access_pointer() is preferred > for NULL tests when no lock is held. > > This uses 3 different ways to access ->future_tbl. > - if we know the mutex is held, use rht_dereference() > - if we don't hold the mutex, and are only testing for NULL, > use rcu_access_pointer() > - otherwise (using RCU protection for true dereference), > use rht_dereference_rcu(). > > Note that this includes a simplification of the call to > rhashtable_last_table() - we don't do an extra dereference > before the call any more. > > Signed-off-by: NeilBrown Acked-by: Herbert Xu -- Email: Herbert Xu Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt