From mboxrd@z Thu Jan 1 00:00:00 1970 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=-14.0 required=3.0 tests=BAYES_00,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS 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 33D1FC4338F for ; Sun, 15 Aug 2021 16:19:58 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 9D99160E52 for ; Sun, 15 Aug 2021 16:19:57 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 9D99160E52 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id E4F918D0001; Sun, 15 Aug 2021 12:19:56 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id DFFE06B0072; Sun, 15 Aug 2021 12:19:56 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id CEEFE8D0001; Sun, 15 Aug 2021 12:19:56 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0067.hostedemail.com [216.40.44.67]) by kanga.kvack.org (Postfix) with ESMTP id B6D706B0071 for ; Sun, 15 Aug 2021 12:19:56 -0400 (EDT) Received: from smtpin12.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 5B9FC180ACF14 for ; Sun, 15 Aug 2021 16:19:56 +0000 (UTC) X-FDA: 78477826392.12.12B683A Received: from mail-qt1-f170.google.com (mail-qt1-f170.google.com [209.85.160.170]) by imf09.hostedemail.com (Postfix) with ESMTP id 1F111300F441 for ; Sun, 15 Aug 2021 16:19:56 +0000 (UTC) Received: by mail-qt1-f170.google.com with SMTP id a12so12456926qtb.2 for ; Sun, 15 Aug 2021 09:19:55 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=OaNQ6551YB6VfeSIvU4gCRECoZk+ivSmQBMFFOyoA7A=; b=RWN72iUnjP7Tf2ejSP7sJLwUUBf3dArpqIwCe3r1Aj7nhWduAbQ9AZurUh9y3Qy+v2 ns73iaMV3AWM5rSWOL4JNwdvf16aQQ+H3FZOGlXyFQRaKFzxvvSjvayrf9LkXElttMAD PMmT4hlaAIq1mQkDVBwFlEGCBwo2LNtfR7kc0jC/XJJAxxam1NJj1n7gw/voqJOR3JBm 69pTHv0JDawzUUGwt648HOiWg7KqkORAVusVWspx6yg6BMHBCK89LRVutCFOHUmi3Ziw r9b3ZAe0YdhuqTEiCxcGnquhMXwmPCnNkYiz0YdUCh8UvhlKB3V+9KvhhAxqRdcc7Nz7 4hfg== X-Gm-Message-State: AOAM532vIy3leeQDO47irqiriv5IBY2w6WQRAi6e5a5OT+j+yS/oeOUh FVZ5cTZ/2zqQ5Gw7xW7W714= X-Google-Smtp-Source: ABdhPJxGVvS5NbEYWUnJkaGcvEG0NzY9tNoDbx1wL5Hydy7J7RKfQWbIfbpM/YNCsOCPv4TjtmgCHQ== X-Received: by 2002:ac8:7612:: with SMTP id t18mr7100667qtq.324.1629044395471; Sun, 15 Aug 2021 09:19:55 -0700 (PDT) Received: from fedora (pool-173-68-57-129.nycmny.fios.verizon.net. [173.68.57.129]) by smtp.gmail.com with ESMTPSA id j185sm4804942qkf.28.2021.08.15.09.19.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 15 Aug 2021 09:19:55 -0700 (PDT) Date: Sun, 15 Aug 2021 12:19:53 -0400 From: Dennis Zhou To: Junhua Huang Cc: dennis@kernel.org, tj@kernel.org, cl@linux.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Junhua Huang Subject: Re: [PATCH] percpu: remove the unnecessary operation for bitmaps in finding suitable region Message-ID: References: <20210815032018.192334-1-junhuahuangdream@163.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210815032018.192334-1-junhuahuangdream@163.com> X-Rspamd-Queue-Id: 1F111300F441 Authentication-Results: imf09.hostedemail.com; dkim=none; spf=pass (imf09.hostedemail.com: domain of dennisszhou@gmail.com designates 209.85.160.170 as permitted sender) smtp.mailfrom=dennisszhou@gmail.com; dmarc=fail reason="SPF not aligned (relaxed), No valid DKIM" header.from=kernel.org (policy=none) X-Rspamd-Server: rspam01 X-Stat-Signature: uscbu3dj6xok1pm9sqja3deie9a8zu87 X-HE-Tag: 1629044396-312515 X-Bogosity: Ham, tests=bogofilter, spamicity=0.020010, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Hello, On Sat, Aug 14, 2021 at 08:20:18PM -0700, Junhua Huang wrote: > 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. > I think you're right in this instance, but I don't think this change is correct as a whole. > 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), \ Removing this makes the iterator by itself wrong. While correct in the current usage, it could potentially be wrong for the next. > 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)) > -- > 2.25.1 > > Thanks, Dennis