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 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4BB61C433EF for ; Sun, 28 Nov 2021 04:57:16 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id C3EBC6B0075; Sat, 27 Nov 2021 23:57:05 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id BEDFD6B0078; Sat, 27 Nov 2021 23:57:05 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id AB55F6B007B; Sat, 27 Nov 2021 23:57:05 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0044.hostedemail.com [216.40.44.44]) by kanga.kvack.org (Postfix) with ESMTP id 9CE9C6B0075 for ; Sat, 27 Nov 2021 23:57:05 -0500 (EST) Received: from smtpin04.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 582C08CE18 for ; Sun, 28 Nov 2021 04:56:55 +0000 (UTC) X-FDA: 78857129190.04.A401FCB Received: from rere.qmqm.pl (rere.qmqm.pl [91.227.64.183]) by imf25.hostedemail.com (Postfix) with ESMTP id B8F78B000184 for ; Sun, 28 Nov 2021 04:56:50 +0000 (UTC) Received: from remote.user (localhost [127.0.0.1]) by rere.qmqm.pl (Postfix) with ESMTPSA id 4J1x6D5pcGz4f; Sun, 28 Nov 2021 05:56:52 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=rere.qmqm.pl; s=1; t=1638075413; bh=Ir3YT3zeL32xImHXMHm+HUkV1uXH+xu9Pk/FdYqejaw=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=qfJt/SEuYDHvacc6G0xjNLwg1Fq717EReqm4qKjJKbJ29nVz4pRzLhvuTEs+OdzmQ YBtV69D9aVFvnRVlMgScH974MXYPVrPlxykIPQGi6nNOPfU8kRQpmThuzgG3a1CYgY 78OZwIEmZp1nYVyJFPH7JKcWetX0Tq4RrwhOe1BNAr0LCbznthHDe87CltKf4hscrH sWADjOEt9FmXj+haWSNMnvon1BnukXnjVIZdfR+TS1YetB95pCqlXSq9QBZTNBbDdH rZ7A1g9OqzSsLIRp6DvBumXPrVPGV6Vae36X2F9VPlEfprs7mm6t+Np5204AGclKvP Nz6Jqvfks862Q== X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.3 at mail Date: Sun, 28 Nov 2021 05:56:51 +0100 From: =?iso-8859-2?Q?Micha=B3_Miros=B3aw?= To: Yury Norov Cc: linux-kernel@vger.kernel.org, bcm-kernel-feedback-list@broadcom.com, kvm@vger.kernel.org, linux-alpha@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-crypto@vger.kernel.org, linux-csky@vger.kernel.org, linux-ia64@vger.kernel.org, linux-mips@vger.kernel.org, linux-mm@kvack.org, linux-perf-users@vger.kernel.org, linux-riscv@lists.infradead.org, linux-s390@vger.kernel.org, linux-snps-arc@lists.infradead.org, linuxppc-dev@lists.ozlabs.org Subject: Re: [PATCH 7/9] lib/cpumask: add num_{possible,present,active}_cpus_{eq,gt,le} Message-ID: References: <20211128035704.270739-1-yury.norov@gmail.com> <20211128035704.270739-8-yury.norov@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-2 Content-Disposition: inline In-Reply-To: <20211128035704.270739-8-yury.norov@gmail.com> X-Rspamd-Server: rspam11 X-Rspamd-Queue-Id: B8F78B000184 X-Stat-Signature: b7i8tqe81noqfi1w3sw5kg9jicsw5om7 Authentication-Results: imf25.hostedemail.com; dkim=pass header.d=rere.qmqm.pl header.s=1 header.b="qfJt/SEu"; spf=pass (imf25.hostedemail.com: domain of mirq-linux@rere.qmqm.pl designates 91.227.64.183 as permitted sender) smtp.mailfrom=mirq-linux@rere.qmqm.pl; dmarc=pass (policy=reject) header.from=rere.qmqm.pl X-HE-Tag: 1638075410-685402 Content-Transfer-Encoding: quoted-printable X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Sat, Nov 27, 2021 at 07:57:02PM -0800, Yury Norov wrote: > Add num_{possible,present,active}_cpus_{eq,gt,le} and replace num_*_cpu= s() > with one of new functions where appropriate. This allows num_*_cpus_*() > to return earlier depending on the condition. [...] > @@ -3193,7 +3193,7 @@ int __init pcpu_page_first_chunk(size_t reserved_= size, > =20 > /* allocate pages */ > j =3D 0; > - for (unit =3D 0; unit < num_possible_cpus(); unit++) { > + for (unit =3D 0; num_possible_cpus_gt(unit); unit++) { This looks dubious. The old version I could hope the compiler would call num_possible_cpus() only once if it's marked const or pure, but the alternative is going to count the bits every time making this a guarantee= d O(n^2) even though the bitmap doesn't change. Best Regards Micha=B3=A0Miros=B3aw