From patchwork Mon Aug 8 09:50:18 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Yongjun X-Patchwork-Id: 9267575 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 9F7456075A for ; Mon, 8 Aug 2016 09:50:34 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8EA8E27569 for ; Mon, 8 Aug 2016 09:50:34 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 82EE127D64; Mon, 8 Aug 2016 09:50:34 +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 3B9A327569 for ; Mon, 8 Aug 2016 09:50:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752008AbcHHJud (ORCPT ); Mon, 8 Aug 2016 05:50:33 -0400 Received: from mail-pa0-f68.google.com ([209.85.220.68]:33758 "EHLO mail-pa0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752005AbcHHJuc (ORCPT ); Mon, 8 Aug 2016 05:50:32 -0400 Received: by mail-pa0-f68.google.com with SMTP id vy10so5202913pac.0 for ; Mon, 08 Aug 2016 02:50:32 -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:mime-version :content-transfer-encoding; bh=RhwwIuyukgEh9dEESFpu+UV/pTAde3pPz6kWJPTuQh4=; b=xoxJQ28j2Sib9UMEElEyzUUbbGveMijWezl+olXwfevNMToIaNbgweYEUtFPWagIk4 upl0U6eLsl/wU7qYbWhCsrNw4Uj4F4ta3ZkWR03LwzeXut/GjakNFzGPBtsjeUDlu3sy XRaFJiUhr7E8ArBnzIjir1jztR6UZEyZ9fIXgjbxQz2B/dKQ2ScimfJ0oNctLS4Dh/+z PSARqhdvsWjdoNl7ACy6U2scbr0RDsvE7u28ecc5JHaM9f4pMAaqtGO6n2Unyw1e/eoY Qeep+UC9YO0clPzi2QPJVztisGS8Oj/HD5obGuF7M33hwc03UzF8IHTHCeF77sb67zI4 u5jg== 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:mime-version :content-transfer-encoding; bh=RhwwIuyukgEh9dEESFpu+UV/pTAde3pPz6kWJPTuQh4=; b=SwgnqbN0baTvSA+Z6PkL4/oYFW9ufSC7vV2E6+Lfg9CexNNwkRzgGeOwZ7YHU/HZsN cUBSgdkj4A9ifnKqiJs2yClQOmTEFOxOm+7+QLzrIFGcO2ZsobqVjLKXKOUs6gbKjzs8 Pc8DaQtbZWPWAOghLC3+B+atx0geAyE1xFQ7nNHZgd1keN7zoLYNNNCT0vA6Q2/8JP3y Icc6GeWACIFB9G4U4d0/cHxrlD/sorDlB48A+ElPHnvlzO3GZDuEqx8Pj3iKQ7pcONUn mWcYfd3WxOsWZDUTVtgCjaw8Hn/BeTx3+1afwit2PbHe3aSUdMrvbGvPNYO5advve1+l TyAA== X-Gm-Message-State: AEkoous0u6o3Sc9jjjE/YMPBPyvQT/Uph9zxyDq1XE8DVwgLelD03RHIv4o4+xUwqqSSvA== X-Received: by 10.66.100.230 with SMTP id fb6mr136962114pab.107.1470649831873; Mon, 08 Aug 2016 02:50:31 -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 o80sm46557528pfa.67.2016.08.08.02.50.27 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 08 Aug 2016 02:50:31 -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] IB/hfi1: Using kfree_rcu() to simplify the code Date: Mon, 8 Aug 2016 09:50:18 +0000 Message-Id: <1470649818-30040-1-git-send-email-weiyj.lk@gmail.com> X-Mailer: git-send-email 2.7.4 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 Nacked-by: Mike Marciniszyn --- drivers/infiniband/hw/hfi1/mad.c | 9 +-------- 1 file changed, 1 insertion(+), 8 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/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)