From patchwork Wed Dec 10 09:24:31 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: roy.qing.li@gmail.com X-Patchwork-Id: 5467681 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 3E367BEEA8 for ; Wed, 10 Dec 2014 09:24:41 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 468E320125 for ; Wed, 10 Dec 2014 09:24:40 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 632D420121 for ; Wed, 10 Dec 2014 09:24:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751353AbaLJJYi (ORCPT ); Wed, 10 Dec 2014 04:24:38 -0500 Received: from mail-pa0-f54.google.com ([209.85.220.54]:55810 "EHLO mail-pa0-f54.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751102AbaLJJYh (ORCPT ); Wed, 10 Dec 2014 04:24:37 -0500 Received: by mail-pa0-f54.google.com with SMTP id fb1so2444106pad.41 for ; Wed, 10 Dec 2014 01:24:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:subject:date:message-id; bh=ooaMkL+BfEvC9yZE7Ux3ra0MqHM3tBR8ljy2z+ilDO4=; b=au3PuV8Jep5PdiIOjHzMhyjPbOZRzIYXWHdhRKIaZuNRJD3+6Su8dU5l5WfMb85eLe cgh10TKoQ5vpTUMgKXtEokD0S2uSZPwLXIX2BrRuVKZQHMyXV9GrU6+AC/sC+cu14cM6 oCO+JbSpL2Xy4jF8tNYWQEvTFvEqEATj8DCEaPnzIFSTYNkRKjYyXqMUllrGCIwQh+cc lddHpuvrDwqR3kXx2KK16+BaEXkXy8oJrhL+uetsK9Lg72+9VVpZJNAngu2aoi1PQTt2 PT1HCYoo8PJCQyLjwZT8gBDqAGHwm8VLmSxnM1fk5NlU6vCOGkF71eEOD0NHushjGTGF I7Ng== X-Received: by 10.68.235.5 with SMTP id ui5mr5278109pbc.152.1418203476992; Wed, 10 Dec 2014 01:24:36 -0800 (PST) Received: from localhost ([106.120.101.38]) by mx.google.com with ESMTPSA id al4sm3664435pbc.19.2014.12.10.01.24.35 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 10 Dec 2014 01:24:36 -0800 (PST) From: roy.qing.li@gmail.com To: faisal.latif@intel.com, roland@kernel.org, sean.hefty@intel.com, hal.rosenstock@gmail.com, linux-rdma@vger.kernel.org Subject: [PATCH] RDMA/nes: remove unnecessary RCU lock Date: Wed, 10 Dec 2014 17:24:31 +0800 Message-Id: <1418203471-14784-1-git-send-email-roy.qing.li@gmail.com> X-Mailer: git-send-email 2.1.0 Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID, T_RP_MATCHES_RCVD, 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 From: Li RongQing The neigh returned from neigh_lookup has its ref added, not need to hold RCU lock and move neigh_release to avoid to check if neigh is NULL again. Signed-off-by: Li RongQing --- drivers/infiniband/hw/nes/nes_cm.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/drivers/infiniband/hw/nes/nes_cm.c b/drivers/infiniband/hw/nes/nes_cm.c index 6f09a72..d9e3b4b 100644 --- a/drivers/infiniband/hw/nes/nes_cm.c +++ b/drivers/infiniband/hw/nes/nes_cm.c @@ -1510,7 +1510,6 @@ static int nes_addr_resolve_neigh(struct nes_vnic *nesvnic, u32 dst_ip, int arpi neigh = neigh_lookup(&arp_tbl, &rt->rt_gateway, netdev); - rcu_read_lock(); if (neigh) { if (neigh->nud_state & NUD_VALID) { nes_debug(NES_DBG_CM, "Neighbor MAC address for 0x%08X" @@ -1535,12 +1534,9 @@ static int nes_addr_resolve_neigh(struct nes_vnic *nesvnic, u32 dst_ip, int arpi } else { neigh_event_send(neigh, NULL); } - } out: - rcu_read_unlock(); - - if (neigh) neigh_release(neigh); + } ip_rt_put(rt); return rc;