Message ID | 20211005054059.475634-14-yury.norov@gmail.com (mailing list archive) |
---|---|
State | New |
Headers | show
Return-Path: <SRS0=pyM+=OZ=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 E0A9FC433F5 for <linux-mm@archiver.kernel.org>; Tue, 5 Oct 2021 05:41:40 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 9749D6023D for <linux-mm@archiver.kernel.org>; Tue, 5 Oct 2021 05:41:40 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 9749D6023D 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 390BB6B0083; Tue, 5 Oct 2021 01:41:40 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 317716B0085; Tue, 5 Oct 2021 01:41:40 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1B75F900002; Tue, 5 Oct 2021 01:41:40 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0146.hostedemail.com [216.40.44.146]) by kanga.kvack.org (Postfix) with ESMTP id 03D696B0083 for <linux-mm@kvack.org>; Tue, 5 Oct 2021 01:41:40 -0400 (EDT) Received: from smtpin01.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id BC1FD2D241 for <linux-mm@kvack.org>; Tue, 5 Oct 2021 05:41:39 +0000 (UTC) X-FDA: 78661286718.01.53F34BB Received: from mail-pf1-f173.google.com (mail-pf1-f173.google.com [209.85.210.173]) by imf28.hostedemail.com (Postfix) with ESMTP id 880839001B75 for <linux-mm@kvack.org>; Tue, 5 Oct 2021 05:41:39 +0000 (UTC) Received: by mail-pf1-f173.google.com with SMTP id m26so3183573pff.3 for <linux-mm@kvack.org>; Mon, 04 Oct 2021 22:41:39 -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=ItK3sXhsAM1f1ASq5u4DaKGjX0YlsAxopFtfKS5hkUGd2sSnkTU+qaKgXZTN57kjrH YyTiguK30n8ixSoHgKeQTHnWXideSR4lXu6Y5AQ1qutTOlTpCfF4vK091PRnFnIemVFq IdLl4+cpPVnnyEkM35F/tFy+WN6FWqNQHEoCuIJJdJ07OO/Q8/wG/CUh7W07ELnQf6LA Vr259OX/kYoyfHAjZHTpVnA1b0afzM45P5r63b+WD8ltL0vaY5hYThrMKobSsbekeQoA FkrL760sIbMTlMuhmcDJ60JMRRgj+4U7jqSsffEqH3hUo3OB+xMEQxsIgIFbn37xPzfn +Aiw== 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=x244SKbGdiIQA4NL52zsZCfiy8Ij5cPjwEXZPYqK11K6pQYpuXniCoWLhWCfAcanoE s68AwKbFnf2nPPY9GPwSloHoXCIIqO3gP2yh56wWqHAIjGLR/x1t5YcK4x8Puj6vfIOV 3VgUy49BY+7Z1Od/MPS/AwkL05tb7MwjZmK5TVOZfNcSY8XBDjBovUdqhHx4d7SCay38 j5h8lfLDd5MuPF46R3Sn0zUp2APXRX35FkzndIVBEdJj6p6Wg08OtBQG3NIqv/bJhH3l pTatJEky4Ljywk/ZiLTRRLAgunYuRA3ggn4F+E1erVnDOTJoxnwMcE69UyCD6rU9OmFA HnFQ== X-Gm-Message-State: AOAM530z+BHtJ38GUuW9oxWNm316xZnw1M7K8Mz4Ybn12QOAJjLuCG3k SGFDfEl2D5bLN+JyNUWqu/Y= X-Google-Smtp-Source: ABdhPJwkGoS5lx+2DFRKSI4puA9sR0Q04TQBSdoQwr4TaY60RgunHwEUf0OU253yIkwHPeX5ysEAEg== X-Received: by 2002:a63:1a65:: with SMTP id a37mr14296966pgm.338.1633412498651; Mon, 04 Oct 2021 22:41:38 -0700 (PDT) Received: from localhost (searspoint.nvidia.com. [216.228.112.21]) by smtp.gmail.com with ESMTPSA id u19sm10821033pfg.18.2021.10.04.22.41.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Oct 2021 22:41:38 -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: Mon, 4 Oct 2021 22:40:56 -0700 Message-Id: <20211005054059.475634-14-yury.norov@gmail.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20211005054059.475634-1-yury.norov@gmail.com> References: <20211005054059.475634-1-yury.norov@gmail.com> MIME-Version: 1.0 X-Rspamd-Server: rspam01 X-Rspamd-Queue-Id: 880839001B75 X-Stat-Signature: ijkbycukzyeugt8qa4knpsewf3pkdzfh Authentication-Results: imf28.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=ItK3sXhs; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf28.hostedemail.com: domain of yury.norov@gmail.com designates 209.85.210.173 as permitted sender) smtp.mailfrom=yury.norov@gmail.com X-HE-Tag: 1633412499-286851 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 |
Bitmap patches for 5.15
|
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; }