From patchwork Thu Aug 26 10:52:15 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "kangning18z@ict.ac.cn" X-Patchwork-Id: 12459507 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 857C0C432BE for ; Thu, 26 Aug 2021 10:59:25 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 65A406108F for ; Thu, 26 Aug 2021 10:59:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231485AbhHZLAL (ORCPT ); Thu, 26 Aug 2021 07:00:11 -0400 Received: from smtp23.cstnet.cn ([159.226.251.23]:45384 "EHLO cstnet.cn" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S241878AbhHZLAJ (ORCPT ); Thu, 26 Aug 2021 07:00:09 -0400 X-Greylist: delayed 405 seconds by postgrey-1.27 at vger.kernel.org; Thu, 26 Aug 2021 07:00:08 EDT Received: from localhost.localdomain (unknown [202.189.3.195]) by APP-03 (Coremail) with SMTP id rQCowABnSVJhcidhUlhUAA--.46249S2; Thu, 26 Aug 2021 18:52:17 +0800 (CST) From: kangning To: linux-rdma@vger.kernel.org Cc: kangning Subject: [PATCH] Fix one error in mthca_alloc Date: Thu, 26 Aug 2021 18:52:15 +0800 Message-Id: <20210826105215.2001-1-kangning18z@ict.ac.cn> X-Mailer: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0xvEx4A2jsIEc7CjxVAFwI0_Jr0_GrUvcSsGvfC2KfnxnUUI43 ZEXa7sRveHJUUUUUU== X-Originating-IP: [202.189.3.195] X-CM-SenderInfo: pndqw0plqjimn26lu3wodfhubq/1tbiBgcFCl0Tfg7GhQAAsz 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. Signed-off-by: kangning Reviewed-by: HÃ¥kon Bugge --- drivers/infiniband/hw/mthca/mthca_allocator.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/infiniband/hw/mthca/mthca_allocator.c b/drivers/infiniband/hw/mthca/mthca_allocator.c index aef1d274a14e..e81bb0fcd08e 100644 --- a/drivers/infiniband/hw/mthca/mthca_allocator.c +++ b/drivers/infiniband/hw/mthca/mthca_allocator.c @@ -51,6 +51,10 @@ u32 mthca_alloc(struct mthca_alloc *alloc) } if (obj < alloc->max) { + alloc->last = (obj + 1); + if (alloc->last == alloc->max) { + alloc->last = 0; + } set_bit(obj, alloc->table); obj |= alloc->top; } else