From patchwork Mon Aug 18 12:32:34 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: 4736111 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 308D89F377 for ; Mon, 18 Aug 2014 12:33:20 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 6C20B20142 for ; Mon, 18 Aug 2014 12:33:19 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 828772012E for ; Mon, 18 Aug 2014 12:33:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751765AbaHRMcs (ORCPT ); Mon, 18 Aug 2014 08:32:48 -0400 Received: from mail-lb0-f170.google.com ([209.85.217.170]:41346 "EHLO mail-lb0-f170.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751753AbaHRMcs (ORCPT ); Mon, 18 Aug 2014 08:32:48 -0400 Received: by mail-lb0-f170.google.com with SMTP id l4so4144470lbv.15 for ; Mon, 18 Aug 2014 05:32:45 -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=FNQSs+c8bNLjBhM03dZTHg6fR8UrVQghYLFgQcDxwPE=; b=D3E1MEjc1Btqs0zyXYoRvoxzmTgyK/oTaOHQYthWTInDEOcA3XqHGFWC2V4eAuYGBI f0qH8icqfZ7HFhRL1SJw9n1lotg17yAatObGmscQMp+qL6vo/xV8xeCBJS0avbNNgAls qBHJUix/TYLPIRIveR+caQE+4EuyGD3jw/1TGGyqBmG00WjLQCEquVrPfo5qtoLjonDu hqvTTGRks2eaz82fHPZVrkQ7fVtM4EyEXwQwC0uAj6yQhVareacf0pFP6Qf6ODC7lhNI MuSQPVZZTH/nSdRB5YhPmibCrEsSjwvAUN6fCcj973eaQLoy67WnP+xnxcEvmmpSWeUK muVA== X-Received: by 10.152.87.97 with SMTP id w1mr2886309laz.92.1408365165173; Mon, 18 Aug 2014 05:32:45 -0700 (PDT) Received: from ada ([85.204.3.189]) by mx.google.com with ESMTPSA id as3sm27004781lbc.7.2014.08.18.05.32.43 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Mon, 18 Aug 2014 05:32:44 -0700 (PDT) Date: Mon, 18 Aug 2014 15:32:34 +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_keys: Replace rcu_assign_pointer() with RCU_INIT_POINTER() Message-ID: <20140818123214.GA8174@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_keys.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/infiniband/hw/qib/qib_keys.c b/drivers/infiniband/hw/qib/qib_keys.c index 3b9afcc..ad843c7 100644 --- a/drivers/infiniband/hw/qib/qib_keys.c +++ b/drivers/infiniband/hw/qib/qib_keys.c @@ -122,10 +122,10 @@ void qib_free_lkey(struct qib_mregion *mr) if (!mr->lkey_published) goto out; if (lkey == 0) - rcu_assign_pointer(dev->dma_mr, NULL); + RCU_INIT_POINTER(dev->dma_mr, NULL); else { r = lkey >> (32 - ib_qib_lkey_table_size); - rcu_assign_pointer(rkt->table[r], NULL); + RCU_INIT_POINTER(rkt->table[r], NULL); } qib_put_mr(mr); mr->lkey_published = 0;