Message ID | 20211001181245.228419-14-yury.norov@gmail.com (mailing list archive) |
---|---|
State | New |
Headers | show
Return-Path: <SRS0=MEXA=OV=kvack.org=owner-linux-mm@kernel.org> X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 59857C433FE for <linux-mm@archiver.kernel.org>; Fri, 1 Oct 2021 18:13:29 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 05E2561263 for <linux-mm@archiver.kernel.org>; Fri, 1 Oct 2021 18:13:29 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 05E2561263 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id A97B8940135; Fri, 1 Oct 2021 14:13:28 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id A2199940121; Fri, 1 Oct 2021 14:13:28 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 899F0940135; Fri, 1 Oct 2021 14:13:28 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0001.hostedemail.com [216.40.44.1]) by kanga.kvack.org (Postfix) with ESMTP id 77393940121 for <linux-mm@kvack.org>; Fri, 1 Oct 2021 14:13:28 -0400 (EDT) Received: from smtpin40.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 374963CC62 for <linux-mm@kvack.org>; Fri, 1 Oct 2021 18:13:28 +0000 (UTC) X-FDA: 78648666096.40.09BDAB5 Received: from mail-pj1-f45.google.com (mail-pj1-f45.google.com [209.85.216.45]) by imf11.hostedemail.com (Postfix) with ESMTP id 0A649F00020F for <linux-mm@kvack.org>; Fri, 1 Oct 2021 18:13:27 +0000 (UTC) Received: by mail-pj1-f45.google.com with SMTP id rm6-20020a17090b3ec600b0019ece2bdd20so7768553pjb.1 for <linux-mm@kvack.org>; Fri, 01 Oct 2021 11:13:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=nf81eMg0W7fVWw+dS1fRTqTJZj1jgno6nh0Ggg55AFs=; b=lLZwpryZB98PlGeM8ZanBwznPLR+qj4BAk9K/uf8CR1i4Vr7ohWNGkej3kVUNqXdVG 1Jz42et237u6yAI2fLT63htNSZHBQhI5hTW5QlTYMfJALg2QS7K341SuCyg4JVoN+kGK yOPWlwz1SZqxUrFbg0dAknq0LNE8mNSh0R3dX8vDH2CEQhdIdhjfR7r7zRN3uJrZXcfW 4oysstkJLDNrmHqITg7OwYcRcURoNhlMq4pNYfSkpvdiR3XB3A3qF8SPFy4Vr8b3LYgh GIuCVYH1I8wQMVDx8yJeJME3oPJHo6nsCRdz2f0rkYcuGYqLc+cVhFZggI3dGfdtYMGP dgRA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=nf81eMg0W7fVWw+dS1fRTqTJZj1jgno6nh0Ggg55AFs=; b=dSf1mY8/Uh1PnafIfkeppqrbHdgWttj0uOcm2ckduFRSve+vD1q3A58VTwTIK3GL7T aEs5scjlRrYUA85MIbwaJqo5kfPeLjZWn6DncSwy8eO60c3Z8JXexwvaCtS4PEjYYvBK 1ssAmGwGUqpmWfBDiPZmvgeFhkFcK4S5+jjELr1HeEXHUCuLtLE8c6+ZPaZR5PNXen8t U0hT5+kcZK8XQxMOKWVSjSzowQipKdiN4vT7Di8SuH1I+BH6M6yv/hfQ1e/8d/JyAgyq 2cYZqhhiKbOSp+LTVsBdmfofNQHYeLwQ4YcE3epyhIyJX8c/9Wb+L5KhoLhB2GoHjFi6 IBQw== X-Gm-Message-State: AOAM531MDCRE4dJQXCfnpoOSlvMO0GkNX+M1r6siDhpOzG3M+twbKASn aQZjj0SJoFr5fSUeuYfp29E= X-Google-Smtp-Source: ABdhPJwxSbuZpik63wXkHcsR03oG0P45JgB69KyL2Up8CkB/6v40eakk14TkFHTNdybDdRPkK7Axtg== X-Received: by 2002:a17:90a:2841:: with SMTP id p1mr15463362pjf.153.1633112006983; Fri, 01 Oct 2021 11:13:26 -0700 (PDT) Received: from localhost (searspoint.nvidia.com. [216.228.112.21]) by smtp.gmail.com with ESMTPSA id o2sm8177868pja.7.2021.10.01.11.13.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Oct 2021 11:13:26 -0700 (PDT) From: Yury Norov <yury.norov@gmail.com> To: Stephen Rothwell <sfr@canb.auug.org.au> Cc: Yury Norov <yury.norov@gmail.com>, Andrew Morton <akpm@linux-foundation.org>, linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-arch@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-mmc@vger.kernel.org, linux-perf-users@vger.kernel.org, kvm@vger.kernel.org, "James E.J. Bottomley" <James.Bottomley@HansenPartnership.com>, Alexander Lobakin <alobakin@pm.me>, Alexander Shishkin <alexander.shishkin@linux.intel.com>, Alexey Klimov <aklimov@redhat.com>, Andrea Merello <andrea.merello@gmail.com>, Andy Shevchenko <andriy.shevchenko@linux.intel.com>, Arnaldo Carvalho de Melo <acme@redhat.com>, Arnd Bergmann <arnd@arndb.de>, Ben Gardon <bgardon@google.com>, Benjamin Herrenschmidt <benh@kernel.crashing.org>, Brian Cain <bcain@codeaurora.org>, Catalin Marinas <catalin.marinas@arm.com>, Christoph Lameter <cl@linux.com>, Daniel Bristot de Oliveira <bristot@redhat.com>, David Hildenbrand <david@redhat.com>, Dennis Zhou <dennis@kernel.org>, Geert Uytterhoeven <geert@linux-m68k.org>, Heiko Carstens <hca@linux.ibm.com>, Ian Rogers <irogers@google.com>, Ingo Molnar <mingo@redhat.com>, Jaegeuk Kim <jaegeuk@kernel.org>, Jakub Kicinski <kuba@kernel.org>, Jiri Olsa <jolsa@redhat.com>, Joe Perches <joe@perches.com>, Jonas Bonn <jonas@southpole.se>, Leo Yan <leo.yan@linaro.org>, Mark Rutland <mark.rutland@arm.com>, Namhyung Kim <namhyung@kernel.org>, Palmer Dabbelt <palmer@dabbelt.com>, Paolo Bonzini <pbonzini@redhat.com>, Peter Xu <peterx@redhat.com>, Peter Zijlstra <peterz@infradead.org>, Petr Mladek <pmladek@suse.com>, Rasmus Villemoes <linux@rasmusvillemoes.dk>, Rich Felker <dalias@libc.org>, Samuel Mendoza-Jonas <sam@mendozajonas.com>, Sean Christopherson <seanjc@google.com>, Sergey Senozhatsky <senozhatsky@chromium.org>, Shuah Khan <shuah@kernel.org>, Stefan Kristiansson <stefan.kristiansson@saunalahti.fi>, Steven Rostedt <rostedt@goodmis.org>, Tejun Heo <tj@kernel.org>, Thomas Bogendoerfer <tsbogend@alpha.franken.de>, Ulf Hansson <ulf.hansson@linaro.org>, Will Deacon <will@kernel.org>, Wolfram Sang <wsa+renesas@sang-engineering.com>, Yoshinori Sato <ysato@users.sourceforge.jp> Subject: [PATCH 13/16] mm/percpu: micro-optimize pcpu_is_populated() Date: Fri, 1 Oct 2021 11:12:42 -0700 Message-Id: <20211001181245.228419-14-yury.norov@gmail.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20211001181245.228419-1-yury.norov@gmail.com> References: <20211001181245.228419-1-yury.norov@gmail.com> MIME-Version: 1.0 Authentication-Results: imf11.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=lLZwpryZ; spf=pass (imf11.hostedemail.com: domain of yury.norov@gmail.com designates 209.85.216.45 as permitted sender) smtp.mailfrom=yury.norov@gmail.com; dmarc=pass (policy=none) header.from=gmail.com X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: 0A649F00020F X-Stat-Signature: 6jsc9r66617j6wzyq9eywqiz74qqbsoa X-HE-Tag: 1633112007-790643 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: <linux-mm.kvack.org> |
Series |
Resend bitmap patches
|
expand
|
diff --git a/mm/percpu.c b/mm/percpu.c index e0a986818903..1cf0bb904b1d 100644 --- a/mm/percpu.c +++ b/mm/percpu.c @@ -1070,17 +1070,18 @@ static void pcpu_block_update_hint_free(struct pcpu_chunk *chunk, int bit_off, static bool pcpu_is_populated(struct pcpu_chunk *chunk, int bit_off, int bits, int *next_off) { - unsigned int page_start, page_end, rs, re; + unsigned int start, end; - page_start = PFN_DOWN(bit_off * PCPU_MIN_ALLOC_SIZE); - page_end = PFN_UP((bit_off + bits) * PCPU_MIN_ALLOC_SIZE); + start = PFN_DOWN(bit_off * PCPU_MIN_ALLOC_SIZE); + end = PFN_UP((bit_off + bits) * PCPU_MIN_ALLOC_SIZE); - rs = page_start; - bitmap_next_clear_region(chunk->populated, &rs, &re, page_end); - if (rs >= page_end) + start = find_next_zero_bit(chunk->populated, end, start); + if (start >= end) return true; - *next_off = re * PAGE_SIZE / PCPU_MIN_ALLOC_SIZE; + end = find_next_bit(chunk->populated, end, start + 1); + + *next_off = end * PAGE_SIZE / PCPU_MIN_ALLOC_SIZE; return false; }