From patchwork Mon Aug 18 12:42:47 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: 4736141 Return-Path: X-Original-To: patchwork-linux-rdma@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id BD66AC0338 for ; Mon, 18 Aug 2014 12:43:01 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id D565C2012E for ; Mon, 18 Aug 2014 12:43:00 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id CDB7C2010E for ; Mon, 18 Aug 2014 12:42:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751158AbaHRMm6 (ORCPT ); Mon, 18 Aug 2014 08:42:58 -0400 Received: from mail-lb0-f176.google.com ([209.85.217.176]:43188 "EHLO mail-lb0-f176.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750789AbaHRMm5 (ORCPT ); Mon, 18 Aug 2014 08:42:57 -0400 Received: by mail-lb0-f176.google.com with SMTP id u10so4141910lbd.35 for ; Mon, 18 Aug 2014 05:42:55 -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=w+OiFXr5BER7DnBgWM+zI+o1XnrkycrS40OCMOTDnu8=; b=sNLhzaZn9VB6xrVVZayYNnULSKkeXWNucsK4fow2DgksRr0qPSdTHIiwDOFpa8NAlt nn1tLuvZvI/cP3GAWohBGL4upVz10C55KV7DvdBkkQYlmbH29LVJAyHVwDP8th89q1Dp CouIPfJjGPK68oMEuZ+/LELq3D1F1r2OXrRr0WMT9TOGI2Hi4IWitDo5qYCPYLgNcGxZ fZ+Kh6myO8m5R/TKIblP0xOzEpII44mvqwRtUKMPL8RUBj4KXiwwNKt1FSIeGcLhw/Rz CZEveKBf2x90w97Km17NanUDxYjNe5DVRRAKDXR9jIQUftf4Opox1Nt1X/4i+qc3tMA0 5Rnw== X-Received: by 10.152.29.230 with SMTP id n6mr29514740lah.29.1408365775679; Mon, 18 Aug 2014 05:42:55 -0700 (PDT) Received: from ada ([85.204.3.189]) by mx.google.com with ESMTPSA id d4sm13390450lbe.47.2014.08.18.05.42.54 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Mon, 18 Aug 2014 05:42:55 -0700 (PDT) Date: Mon, 18 Aug 2014 15:42:47 +0300 From: Andreea-Cristina Bernat To: infinipath@intel.com, roland@kernel.org, sean.hefty@intel.com, hal.rosenstock@gmail.com, linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org Cc: paulmck@linux.vnet.ibm.com Subject: [PATCH] qib_qp: Replace rcu_assign_pointer() with RCU_INIT_POINTER() Message-ID: <20140818124246.GA18423@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 uses of "rcu_assign_pointer()" are NULLing out the pointers. 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/hw/qib/qib_qp.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/infiniband/hw/qib/qib_qp.c b/drivers/infiniband/hw/qib/qib_qp.c index 7fcc150..17daf42 100644 --- a/drivers/infiniband/hw/qib/qib_qp.c +++ b/drivers/infiniband/hw/qib/qib_qp.c @@ -255,10 +255,10 @@ static void remove_qp(struct qib_ibdev *dev, struct qib_qp *qp) if (rcu_dereference_protected(ibp->qp0, lockdep_is_held(&dev->qpt_lock)) == qp) { - rcu_assign_pointer(ibp->qp0, NULL); + RCU_INIT_POINTER(ibp->qp0, NULL); } else if (rcu_dereference_protected(ibp->qp1, lockdep_is_held(&dev->qpt_lock)) == qp) { - rcu_assign_pointer(ibp->qp1, NULL); + RCU_INIT_POINTER(ibp->qp1, NULL); } else { struct qib_qp *q; struct qib_qp __rcu **qpp; @@ -315,7 +315,7 @@ unsigned qib_free_all_qps(struct qib_devdata *dd) for (n = 0; n < dev->qp_table_size; n++) { qp = rcu_dereference_protected(dev->qp_table[n], lockdep_is_held(&dev->qpt_lock)); - rcu_assign_pointer(dev->qp_table[n], NULL); + RCU_INIT_POINTER(dev->qp_table[n], NULL); for (; qp; qp = rcu_dereference_protected(qp->next, lockdep_is_held(&dev->qpt_lock)))