Received: by 2002:a05:6a10:c7d3:0:0:0:0 with SMTP id h19csp1091327pxy; Sun, 15 Aug 2021 09:30:52 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzTef5Am7gtCKoGXZFuiw7TwixzDpDIVIQ1W7fCpnpNavUUnc3VTTqyJ1qh2Qt+a5ukPqlg X-Received: by 2002:a05:6402:27d1:: with SMTP id c17mr15154839ede.178.1629045051878; Sun, 15 Aug 2021 09:30:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629045051; cv=none; d=google.com; s=arc-20160816; b=JvHIr+BCXfhI132iSg3ePEbmOD8TIISGJXfzH63apTw2korOvotsK7CKQnAi+tOU6k E+H2JFze/LMLFsx9UkxPhPmj3YiI0uMGMfDz6hWXLhuLAjfgVvPkuHlq9+VnRBOitDXL qOnHWdrusO6735JMQ2p8MCTL5nbNdsTz2ptvjndHX9/tnVhRgs1ZYwz+QZnMYAjgQH+v Qgvbg8VJczBNM64ezawivoW8gR1HyT07zmP24lUiNDZ05WitRPtmthUWJNIhDE69dmDn qyRSrv9YOghT00qlRCP4Vu+uA0m85OBAKTz00u0QdPP8rrWCWqeZ9/wI8lsnUrFo0HxW 0F1g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=OaNQ6551YB6VfeSIvU4gCRECoZk+ivSmQBMFFOyoA7A=; b=ZbC1B3eH5ABmox2V6VijMrPhO50qM3FBptTQNAK7m1kDSp5z/GBY7nF02zRiiAQtSq se3sgMyBy1RJ3BP6TGlsD204VYOpYf78hgpW97C1rTDNkV3cE9dLK8PyHPGPBCw17nYL a732kjqP1pAbpmVzUVBlogEWtXSdrT+MHxAVVsBFkosA5YcN2Dy2qzmw6eooVjgHgbvR 6nTFhhzIE0C2S86DyrVlDBgGt+b5ixecgv9ZES1GPVblrJyblF0DJjadzgI0/sN3iLw3 RToxF3sYzlZVnnmGWi5hxmqTVztIWSH/wCtpcWYmseMeNI3UWdKED9WdDpoNwtPG9zZ6 s8/g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y16si2618576edd.310.2021.08.15.09.29.48; Sun, 15 Aug 2021 09:30:51 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229574AbhHOQU0 (ORCPT + 99 others); Sun, 15 Aug 2021 12:20:26 -0400 Received: from mail-qt1-f170.google.com ([209.85.160.170]:37805 "EHLO mail-qt1-f170.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229490AbhHOQU0 (ORCPT ); Sun, 15 Aug 2021 12:20:26 -0400 Received: by mail-qt1-f170.google.com with SMTP id l24so12458655qtj.4 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=oUW4QhdAG8a1aWwq2zRGwogh0XASQeBm83Ew8DrG+FxPgPVH+MzPeylQBFAqRbRlsR mjl7RS/nTmidLu2vvB7sOVs7xtgSGkweUXdVaWUd7k/3T/I9CVEfSPTosQotN+pQc0JB 0bjjtn3JaB5LhMXdOfqw4pIRmUwWImgj8cAIgscORVXxzlu5HRQiVlsBgImgTNIA6+rX 1FFfiOSaK8lSWslt2dLw4y5kA0R8cm6F6UZtBQmpyiOWYVCjShG1lEmmH+KXrG5DTg4d hMFV+ljBONcvg1trCaHIsv5UIrvDfZmkHXof1DCz6gHJinFAF1eO5k5oVMvJimdd37dq 5wOg== X-Gm-Message-State: AOAM530N7ntyjhZawZu1f1bJfnjtx4/Me0bg6tT4RFFaXWVdeirilZ82 Pcxq3Tsk2Hmnc//nCYzaP5U= 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> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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