From patchwork Mon Aug 18 14:23:33 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreea-Cristina Bernat X-Patchwork-Id: 4736981 Return-Path: X-Original-To: patchwork-linux-rdma@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 661F19F377 for ; Mon, 18 Aug 2014 14:23:50 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 8B5092011D for ; Mon, 18 Aug 2014 14:23:49 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 9C0EE20120 for ; Mon, 18 Aug 2014 14:23:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751648AbaHROXr (ORCPT ); Mon, 18 Aug 2014 10:23:47 -0400 Received: from mail-la0-f47.google.com ([209.85.215.47]:65007 "EHLO mail-la0-f47.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751494AbaHROXq (ORCPT ); Mon, 18 Aug 2014 10:23:46 -0400 Received: by mail-la0-f47.google.com with SMTP id mc6so4569625lab.20 for ; Mon, 18 Aug 2014 07:23:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:cc:subject:message-id:mime-version:content-type :content-disposition:user-agent; bh=pHQXCnTgSgSWnM0+7UN4v6g0tNGQB4I68KwtMcuvMDw=; b=QZvUlU8DGL/GDdJrhuisUeQ3EfTNMD2GIdf0ECEDInmIQ32GqOhYoJDFm0cPPXsNIY iV6EXLZ7Szb3u4kDIV8yCG6ua0ymkTpHLRz8RcrRLajB14gwJXKT6wItMkrtR+sZiYmp U9otV8dKFUX7Lx0NcNV3sBYNdZ2pJpil4S5C4r99oJ1rjlt6WvlgjJnWmsiar4YDzva4 7yHXBjaAL14Hb0O3a49lmbr9Ufdm/B4of/Zg0dkN/pWw8WBvWLJOkbjgCDJn6LgQd0IN XpKHcsb1pscIdS43pLx9sNgGobDH2a1RmPdbKB3c8YW8WaNqqDJZZWN/ozszN4qJRR/+ ojkQ== X-Received: by 10.112.255.36 with SMTP id an4mr28819340lbd.31.1408371824548; Mon, 18 Aug 2014 07:23:44 -0700 (PDT) Received: from ada ([85.204.3.189]) by mx.google.com with ESMTPSA id um4sm17610598lbb.40.2014.08.18.07.23.42 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Mon, 18 Aug 2014 07:23:43 -0700 (PDT) Date: Mon, 18 Aug 2014 17:23:33 +0300 From: Andreea-Cristina Bernat To: roland@kernel.org, sean.hefty@intel.com, hal.rosenstock@gmail.com, erezsh@mellanox.com, mschmidt@redhat.com, ogerlitz@mellanox.com, linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org Cc: paulmck@linux.vnet.ibm.com Subject: [PATCH] ipoib: Replace rcu_assign_pointer() with RCU_INIT_POINTER() Message-ID: <20140818142333.GA1561@ada> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Spam-Status: No, score=-7.5 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The use of "rcu_assign_pointer()" is NULLing out the pointer. According to RCU_INIT_POINTER()'s block comment: "1. This use of RCU_INIT_POINTER() is NULLing out the pointer" it is better to use it instead of rcu_assign_pointer() because it has a smaller overhead. The following Coccinelle semantic patch was used: @@ @@ - rcu_assign_pointer + RCU_INIT_POINTER (..., NULL) Signed-off-by: Andreea-Cristina Bernat --- drivers/infiniband/ulp/ipoib/ipoib_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/infiniband/ulp/ipoib/ipoib_main.c b/drivers/infiniband/ulp/ipoib/ipoib_main.c index 5786a78..64cd5b5 100644 --- a/drivers/infiniband/ulp/ipoib/ipoib_main.c +++ b/drivers/infiniband/ulp/ipoib/ipoib_main.c @@ -1229,7 +1229,7 @@ static void ipoib_flush_neighs(struct ipoib_dev_priv *priv) } free_htbl: - rcu_assign_pointer(ntbl->htbl, NULL); + RCU_INIT_POINTER(ntbl->htbl, NULL); call_rcu(&htbl->rcu, neigh_hash_free_rcu); out_unlock: