From patchwork Sun Aug 15 03:20:18 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Junhua Huang X-Patchwork-Id: 12437079 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=-13.5 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,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 32AA8C4338F for ; Sun, 15 Aug 2021 03:37:55 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id C2FE26103A for ; Sun, 15 Aug 2021 03:37:54 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org C2FE26103A Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=163.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id 3CADD6B0078; Sat, 14 Aug 2021 23:37:54 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 3524E8D0001; Sat, 14 Aug 2021 23:37:54 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 219FF6B007D; Sat, 14 Aug 2021 23:37:54 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0190.hostedemail.com [216.40.44.190]) by kanga.kvack.org (Postfix) with ESMTP id 052FD6B0078 for ; Sat, 14 Aug 2021 23:37:53 -0400 (EDT) Received: from smtpin17.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id A43B38249980 for ; Sun, 15 Aug 2021 03:37:53 +0000 (UTC) X-FDA: 78475906026.17.5D290C0 Received: from mail-m9764.mail.163.com (mail-m9764.mail.163.com [123.126.97.64]) by imf21.hostedemail.com (Postfix) with ESMTP id AFE2FD0246B8 for ; Sun, 15 Aug 2021 03:37:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=163.com; s=s110527; h=From:Subject:Date:Message-Id:MIME-Version; bh=VqxE2 6W/p5gCQWidblx3vz+89p1P5HiPYzrdJ0nbxBE=; b=S80Oe940LIyxapOnaphhI EZ1sIvz3l410AHZItzifJ83PQkslK0BrFRNsA+TGSjsqk7/00Yo57BLyTibwftg+ EXCkh5a/YYgRh17y8UMql1U3Bg97LyZ/9NpfdVE0c19Tj7/zQrwnEYeyuHmQIXu2 U4UPk3bvSJDnV2NrET2Z1E= Received: from ubuntu.localdomain (unknown [183.220.91.139]) by smtp14 (Coremail) with SMTP id EsCowADX3Qn1hxhh2Jihzw--.61169S2; Sun, 15 Aug 2021 11:20:21 +0800 (CST) From: Junhua Huang To: dennis@kernel.org, tj@kernel.org, cl@linux.com Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, Junhua Huang Subject: [PATCH] percpu: remove the unnecessary operation for bitmaps in finding suitable region Date: Sat, 14 Aug 2021 20:20:18 -0700 Message-Id: <20210815032018.192334-1-junhuahuangdream@163.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-CM-TRANSID: EsCowADX3Qn1hxhh2Jihzw--.61169S2 X-Coremail-Antispam: 1Uf129KBjvJXoW7XFWDJw4UWry8uw4fZry7Wrg_yoW8Jr48pr W5WFyDKr1DAw43u3WktwnrXr15uwn8tw4rCw45Gr9xZ3ZxC345WFW0gw4Yga4xCasxur1a vw4DWFy7JayUXaDanT9S1TB71UUUUU7qnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDUYxBIdaVFxhVjvjDU0xZFpf9x07j2WlkUUUUU= X-Originating-IP: [183.220.91.139] X-CM-SenderInfo: xmxqx3pdkxt05jguvtrp6rljoofrz/1tbipRbvZVUMf9Wd1wAAsA X-Rspamd-Queue-Id: AFE2FD0246B8 Authentication-Results: imf21.hostedemail.com; dkim=pass header.d=163.com header.s=s110527 header.b=S80Oe940; dmarc=pass (policy=none) header.from=163.com; spf=pass (imf21.hostedemail.com: domain of junhuahuangdream@163.com designates 123.126.97.64 as permitted sender) smtp.mailfrom=junhuahuangdream@163.com X-Rspamd-Server: rspam04 X-Stat-Signature: 3yjeon7x9tgtqyhu5tps7a48xwbnf9o1 X-HE-Tag: 1628998672-231355 X-Bogosity: Ham, tests=bogofilter, spamicity=0.026224, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: From: Junhua Huang We use pcpu_next_fit_region to find the next fit region for alloc. Once return, the region fit the request and then break the loop, or get the next start offset from pcpu_is_populated. So there is no necessary to add bits to bit_off. At the same time, bits will set 0 in pcpu_next_fit_region each time, so I think it is unnecessary to set bits zero in pcpu_for_each_fit_region loops. Signed-off-by: Junhua Huang --- mm/percpu.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/mm/percpu.c b/mm/percpu.c index 7f2e0151c4e2..ec7a5d10f6c9 100644 --- a/mm/percpu.c +++ b/mm/percpu.c @@ -489,7 +489,6 @@ static void pcpu_next_fit_region(struct pcpu_chunk *chunk, int alloc_bits, for (pcpu_next_fit_region((chunk), (alloc_bits), (align), &(bit_off), \ &(bits)); \ (bit_off) < pcpu_chunk_map_bits((chunk)); \ - (bit_off) += (bits), \ pcpu_next_fit_region((chunk), (alloc_bits), (align), &(bit_off), \ &(bits))) @@ -1126,7 +1125,6 @@ static int pcpu_find_block_fit(struct pcpu_chunk *chunk, int alloc_bits, break; bit_off = next_off; - bits = 0; } if (bit_off == pcpu_chunk_map_bits(chunk))