From patchwork Wed Aug 10 03:14:04 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Yongjun X-Patchwork-Id: 9272547 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 066C6600CB for ; Wed, 10 Aug 2016 03:14:15 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CF3B5283E2 for ; Wed, 10 Aug 2016 03:14:14 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C3BC828404; Wed, 10 Aug 2016 03:14:14 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 707D8283E2 for ; Wed, 10 Aug 2016 03:14:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932697AbcHJDON (ORCPT ); Tue, 9 Aug 2016 23:14:13 -0400 Received: from mail-pa0-f67.google.com ([209.85.220.67]:33259 "EHLO mail-pa0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932669AbcHJDOM (ORCPT ); Tue, 9 Aug 2016 23:14:12 -0400 Received: by mail-pa0-f67.google.com with SMTP id vy10so1976468pac.0 for ; Tue, 09 Aug 2016 20:14:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=v638zTE/nDY8eOCuUS8RFkabRRqDoonspl5VtzDVi18=; b=gclBkeyELpASqRr2p+kctFWkyFl0GrG6pSBLsR/tyyIRbeliKebLNH7tkQl9fP8Wc1 vrlUmGpwC2TgVekbKZP48K1kHhMJSPIFptXnlRxKbVwaxH3hlFkTCZPbLSy5Xkfg0GXM aFe+Zir3MijDHMrMSVGkL6OS6zuuxjWLTTDpmy5edqddMx0YOZB8EWWT8UMcgss/F2XN Ww7msB2Cqs6MqgKvIWcyWyWbO/PNaH10w9bvcZ4JM9aXPDiR2YzbWRyl7Z2m8eOQa5iZ B0Y6eCXVDM/mi9EqW5R0Iz01whzfVJfHKYIXlCyO2FdP+4hKwFEIkFMLgb/UxkRQ2EnF 3Osg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=v638zTE/nDY8eOCuUS8RFkabRRqDoonspl5VtzDVi18=; b=evaecgiCRfVnO8M4EqV5Izbm1k9D8v3jTG8Y4cTNAgmIYOp9lxfywktQYrbscYhNt8 SoBgtnayNz8oIfnLpr/OjQDtKP25Gph8o4NbmfFSTHLs4L4WsHXmpVwVBYdpT6CtHPQO kcZ+xGe+Wnf6KoaadO2FZxSNfIJKn3Nc1NIda8HYMCdZW8LulXYfA7udwQyfl9krB3la BfxqlgdDw7Ytj6FIS2YK4kZP8bKM81bGUqIlcC7f/CX4MV10Djf8hlC8YYDy6hTRcdWV /qWJkM81aXoIBo5aE7DMpGRahDO/4jntEd5FmKoOFEryJs51Vb9xwzFBeGAXiPBEf2ET F9ug== X-Gm-Message-State: AEkoouu1Zedf3L8T7FsSi7u1uD5lSLyxqkm3azkGQrVVuV/bLGFxcn+LN/P6FkxMFZhn/Q== X-Received: by 10.66.183.80 with SMTP id ek16mr2998721pac.21.1470798852067; Tue, 09 Aug 2016 20:14:12 -0700 (PDT) Received: from bogon.localdomain (ec2-52-192-197-227.ap-northeast-1.compute.amazonaws.com. [52.192.197.227]) by smtp.gmail.com with ESMTPSA id ad15sm59311247pac.33.2016.08.09.20.14.07 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 09 Aug 2016 20:14:11 -0700 (PDT) From: Wei Yongjun To: Mike Marciniszyn , Dennis Dalessandro , Doug Ledford , Sean Hefty , Hal Rosenstock Cc: Wei Yongjun , linux-rdma@vger.kernel.org Subject: [PATCH v2] IB/hfi1: Using kfree_rcu() to simplify the code Date: Wed, 10 Aug 2016 03:14:04 +0000 Message-Id: <1470798844-30421-1-git-send-email-weiyj.lk@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1470649818-30040-1-git-send-email-weiyj.lk@gmail.com> References: <1470649818-30040-1-git-send-email-weiyj.lk@gmail.com> MIME-Version: 1.0 Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The callback function of call_rcu() just calls a kfree(), so we can use kfree_rcu() instead of call_rcu() + callback function. Signed-off-by: Wei Yongjun Tested-by: Mike Marciniszyn Acked-by: Mike Marciniszyn Tested-by: Mike Marciniszyn Acked-by: Mike Marciniszyn --- drivers/infiniband/hw/hfi1/hfi.h | 1 - drivers/infiniband/hw/hfi1/init.c | 2 +- drivers/infiniband/hw/hfi1/mad.c | 9 +-------- 3 files changed, 2 insertions(+), 10 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/infiniband/hw/hfi1/hfi.h b/drivers/infiniband/hw/hfi1/hfi.h index 1000e0f..f41414e 100644 --- a/drivers/infiniband/hw/hfi1/hfi.h +++ b/drivers/infiniband/hw/hfi1/hfi.h @@ -1656,7 +1656,6 @@ struct cc_state *get_cc_state_protected(struct hfi1_pportdata *ppd) struct hfi1_devdata *hfi1_init_dd(struct pci_dev *, const struct pci_device_id *); void hfi1_free_devdata(struct hfi1_devdata *); -void cc_state_reclaim(struct rcu_head *rcu); struct hfi1_devdata *hfi1_alloc_devdata(struct pci_dev *pdev, size_t extra); /* LED beaconing functions */ diff --git a/drivers/infiniband/hw/hfi1/init.c b/drivers/infiniband/hw/hfi1/init.c index a358d23..b793545 100644 --- a/drivers/infiniband/hw/hfi1/init.c +++ b/drivers/infiniband/hw/hfi1/init.c @@ -1333,7 +1333,7 @@ static void cleanup_device_data(struct hfi1_devdata *dd) spin_unlock(&ppd->cc_state_lock); if (cc_state) - call_rcu(&cc_state->rcu, cc_state_reclaim); + kfree_rcu(cc_state, rcu); } free_credit_return(dd); diff --git a/drivers/infiniband/hw/hfi1/mad.c b/drivers/infiniband/hw/hfi1/mad.c index 1263abe..95c43e1 100644 --- a/drivers/infiniband/hw/hfi1/mad.c +++ b/drivers/infiniband/hw/hfi1/mad.c @@ -3398,7 +3398,7 @@ static void apply_cc_state(struct hfi1_pportdata *ppd) spin_unlock(&ppd->cc_state_lock); - call_rcu(&old_cc_state->rcu, cc_state_reclaim); + kfree_rcu(old_cc_state, rcu); } static int __subn_set_opa_cong_setting(struct opa_smp *smp, u32 am, u8 *data, @@ -3553,13 +3553,6 @@ static int __subn_get_opa_cc_table(struct opa_smp *smp, u32 am, u8 *data, return reply((struct ib_mad_hdr *)smp); } -void cc_state_reclaim(struct rcu_head *rcu) -{ - struct cc_state *cc_state = container_of(rcu, struct cc_state, rcu); - - kfree(cc_state); -} - static int __subn_set_opa_cc_table(struct opa_smp *smp, u32 am, u8 *data, struct ib_device *ibdev, u8 port, u32 *resp_len)