From patchwork Thu Aug 26 14:28:28 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "kangning18z@ict.ac.cn" X-Patchwork-Id: 12460015 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D5FC5C432BE for ; Thu, 26 Aug 2021 14:28:52 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A595760F91 for ; Thu, 26 Aug 2021 14:28:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242708AbhHZO3j (ORCPT ); Thu, 26 Aug 2021 10:29:39 -0400 Received: from smtp23.cstnet.cn ([159.226.251.23]:42292 "EHLO cstnet.cn" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S231458AbhHZO3i (ORCPT ); Thu, 26 Aug 2021 10:29:38 -0400 Received: from localhost.localdomain (unknown [202.189.3.195]) by APP-03 (Coremail) with SMTP id rQCowAC3Oo4OpSdhgC9WAA--.24574S2; Thu, 26 Aug 2021 22:28:30 +0800 (CST) From: kangning To: haakon.bugge@oracle.com Cc: linux-rdma@vger.kernel.org, kangning Subject: [PATCH v2] Fix one error in mthca_alloc Date: Thu, 26 Aug 2021 22:28:28 +0800 Message-Id: <20210826142828.9169-1-kangning18z@ict.ac.cn> X-Mailer: git-send-email 2.17.1 X-CM-TRANSID: rQCowAC3Oo4OpSdhg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cSsGvfC2KfnxnUUI43 ZEXa7sRdWrAUUUUUU== X-Originating-IP: [202.189.3.195] X-CM-SenderInfo: pndqw0plqjimn26lu3wodfhubq/1tbiBggFCl0Tfg9SWgAAs2 Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org drivers/infiniband/hw/mthca/mthca_allocator.c: alloc->last left unchanged in mthca_alloc, which has impact on performance of function find_next_zero_bit in mthca_alloc. And the parenthesis and braces are removed in this version. Signed-off-by: kangning --- Thanks for your review, and the parenthesis and braces have been removed in this version. drivers/infiniband/hw/mthca/mthca_allocator.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/infiniband/hw/mthca/mthca_allocator.c b/drivers/infiniband/hw/mthca/mthca_allocator.c index e81bb0fcd08e..1141695093e7 100644 --- a/drivers/infiniband/hw/mthca/mthca_allocator.c +++ b/drivers/infiniband/hw/mthca/mthca_allocator.c @@ -51,10 +51,9 @@ u32 mthca_alloc(struct mthca_alloc *alloc) } if (obj < alloc->max) { - alloc->last = (obj + 1); - if (alloc->last == alloc->max) { + alloc->last = obj + 1; + if (alloc->last == alloc->max) alloc->last = 0; - } set_bit(obj, alloc->table); obj |= alloc->top; } else