Message ID | 20230522110849.2921-10-urezki@gmail.com (mailing list archive) |
---|---|
State | New |
Headers | show
Return-Path: <owner-linux-mm@kvack.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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 11D43C77B73 for <linux-mm@archiver.kernel.org>; Mon, 22 May 2023 11:09:10 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 57DB728000A; Mon, 22 May 2023 07:09:03 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 506B4280002; Mon, 22 May 2023 07:09:03 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3ADC228000A; Mon, 22 May 2023 07:09:03 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 1FCDB280002 for <linux-mm@kvack.org>; Mon, 22 May 2023 07:09:03 -0400 (EDT) Received: from smtpin20.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 01DE31C7DD5 for <linux-mm@kvack.org>; Mon, 22 May 2023 11:09:02 +0000 (UTC) X-FDA: 80817618966.20.56CF4E2 Received: from mail-ej1-f44.google.com (mail-ej1-f44.google.com [209.85.218.44]) by imf07.hostedemail.com (Postfix) with ESMTP id 113464000A for <linux-mm@kvack.org>; Mon, 22 May 2023 11:09:00 +0000 (UTC) Authentication-Results: imf07.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=PvB7xNb9; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf07.hostedemail.com: domain of urezki@gmail.com designates 209.85.218.44 as permitted sender) smtp.mailfrom=urezki@gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1684753741; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=f2bGuuQYL8b+xbvuLn4PcYekQUWt9yPN5iQ314l4lMI=; b=JnZSRMQkV6NeEoqULONcxNPxh+V41UlTFQapE4Bmve9lXDrplAH6DxVJL0AQ2YmY11N6+E Yhyw7y60YB1QnSumKdR22c0wddDAirfCMb+pafN3h/p17PoUnH17TSf/WfygFMOtaeDPjZ 5rONHL71MrzY30CqcFNqvw8JosnUZYI= ARC-Authentication-Results: i=1; imf07.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=PvB7xNb9; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf07.hostedemail.com: domain of urezki@gmail.com designates 209.85.218.44 as permitted sender) smtp.mailfrom=urezki@gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1684753741; a=rsa-sha256; cv=none; b=sZ2/cTb7MSnoSLlR6y8TBrinwJGZML6Nedw194CcPglFEJ0hepxBvW2Wx1kf+10uPCDy40 dPeG+jPvaj3wHZJkftAWnUulQTCrqBXiG5b92SozRfMxjlQn6emOTNxtl60ZUTBA3I6Ibe wD4cfm5ZQeg4Pneeu93zae53SPpCinw= Received: by mail-ej1-f44.google.com with SMTP id a640c23a62f3a-96fd3a658eeso174379466b.1 for <linux-mm@kvack.org>; Mon, 22 May 2023 04:09:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1684753739; x=1687345739; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=f2bGuuQYL8b+xbvuLn4PcYekQUWt9yPN5iQ314l4lMI=; b=PvB7xNb9ygkZOuxzTtzRZdOhB6MfhJSa/XRAM+BYE1xoLfv+ewUOyX4VD8Bu0FXaOK AXlUTKkyIK2WVRsD39QMuEntv1HpM65yERdXpxKJXgRGMC2pW3R98Ogtx7X6mgbxBHMR ldToVDFezt0XeMtgZh1MaqlUYU2be1G2xPupT/rIWTKOSu/1KFkLMDIX1H3BLSGe29sO Fg3kOpF9fGfKN44fAOhFpBwP9Z7IQ03rJSGvaYH1M1Nh+mhzwxadyfvgGc5HplBYwh3q fzDEE5gFHzKH0XnCa9ZqMPOjoi2odYahJQNJL0GrEIc+/7U+m3d4QYr1A8eWf9czKONh 1f4A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684753739; x=1687345739; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=f2bGuuQYL8b+xbvuLn4PcYekQUWt9yPN5iQ314l4lMI=; b=D2jq/5G+H9bBcyLYVrOUsIeXt99VCDrVXXir4e9hFCB3y4u1zBBe2/mnpUPx5UXa21 h1QcSDosSzEgscazRWNk4je5ilTXSumVpRhZR4goMEws+GrzfdoWxLVHkgRA2ufYH21E afwFuQSzZI1PoVEmCi5n6JJX/tLGA1uGs+V12UhcezOh29mghMb/PdxLJGV4/PPTJtRm XqmC8dQShuCXvDEEQ68tR09MoOuaa6N8QkLISgaTLKd5lkitluVjTGtMwrcDcuhrh2hl 1hb5js4ihMQk8bCKNI39xzfR8oa6gMcBifsK1PfacqdS5qIa8XfjuJr5cmK8W65Ss8/q Qe1Q== X-Gm-Message-State: AC+VfDx3rXz2JT6Hj/IDaGKnlDX4qrskiYdk/UFjI5ZNq9iqxX0v7CoO 2u0/LE3GBpo+77oRh2h6f+e0eRpvqoke6Q== X-Google-Smtp-Source: ACHHUZ7OjSrTldnv+rUkfYY8jX9+e0NK8wBEQHN/GocoDZWHojfGcLerDTURKKOgb/QQDOHh1JKUqA== X-Received: by 2002:a17:907:a42a:b0:96f:a7d9:6e86 with SMTP id sg42-20020a170907a42a00b0096fa7d96e86mr6231547ejc.1.1684753739445; Mon, 22 May 2023 04:08:59 -0700 (PDT) Received: from pc638.lan ([155.137.26.201]) by smtp.gmail.com with ESMTPSA id lx19-20020a170906af1300b0094f07545d40sm2949453ejb.220.2023.05.22.04.08.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 May 2023 04:08:59 -0700 (PDT) From: "Uladzislau Rezki (Sony)" <urezki@gmail.com> To: linux-mm@kvack.org, Andrew Morton <akpm@linux-foundation.org> Cc: LKML <linux-kernel@vger.kernel.org>, Baoquan He <bhe@redhat.com>, Lorenzo Stoakes <lstoakes@gmail.com>, Christoph Hellwig <hch@infradead.org>, Matthew Wilcox <willy@infradead.org>, "Liam R . Howlett" <Liam.Howlett@oracle.com>, Dave Chinner <david@fromorbit.com>, "Paul E . McKenney" <paulmck@kernel.org>, Joel Fernandes <joel@joelfernandes.org>, Uladzislau Rezki <urezki@gmail.com>, Oleksiy Avramchenko <oleksiy.avramchenko@sony.com> Subject: [PATCH 9/9] mm: vmalloc: Scale and activate cvz_size Date: Mon, 22 May 2023 13:08:49 +0200 Message-Id: <20230522110849.2921-10-urezki@gmail.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230522110849.2921-1-urezki@gmail.com> References: <20230522110849.2921-1-urezki@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Rspam-User: X-Stat-Signature: sbbsa4z9fxu1sqgb6f3kew87imroia4w X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: 113464000A X-HE-Tag: 1684753740-562281 X-HE-Meta: U2FsdGVkX1/aJ5TobSOxnHF53DGhs+7nUtt8jvejA7Z3G4yRGpKuySgQLNexvB8qZLEq1xQz9XQUJy7sM7PTfhaDUf/yyu7AIcmTrXQiE3pd9VtfVbWH73JTlqJwaTJtnHbD5qmgdDsKt4oXkfr8VhzdNuSFdQ2pW+hV9xG1Fh3pt/Fm7uUGZo3TITjMHUjnVJkGZ9DqqL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wK2GLRLJYQPamQDggDTbRXxWnWwhKnfOG6ZkAcvpxQhhB8jZqaVXwr5xV8kEOi7FT4EgWsaws9vk0GmtDnbUw5f1H/gBSjFFeFM0nmzJlclBowWZ3BC8JF1wH/xw++O52FUa6PrIvPQ0jEvSH+2nXlNva75AzaBSL55zVQnSFwT8bIS8NH0POvmPRwFFNPE/jzqAWITJ08= 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 |
Mitigate a vmap lock contention
|
expand
|
diff --git a/mm/vmalloc.c b/mm/vmalloc.c index 8054b8bf6c18..a5e6956a8da4 100644 --- a/mm/vmalloc.c +++ b/mm/vmalloc.c @@ -806,8 +806,6 @@ struct cpu_vmap_zone { }; static DEFINE_PER_CPU(struct cpu_vmap_zone, cpu_vmap_zone); - -/* Disable a per-cpu caching. */ static __read_mostly unsigned long cvz_size = ULONG_MAX; static inline unsigned int @@ -4490,6 +4488,19 @@ static void vmap_init_pcpu_zones(void) spin_lock_init(&z->fbl[j].lock); } } + + /* + * Scale a zone size to number of CPUs. Each power of two + * value adds extra 100 pages to a zone size. A high-threshold + * limit is set to 4M. It can be reached if number of CPUs=1024 + * whereas a PAGE_SIZE is 4096 bytes. + */ +#if BITS_PER_LONG == 64 + if (i > 1) { + cvz_size = fls(i) * (100 * PAGE_SIZE); + cvz_size = min(cvz_size, (unsigned long) SZ_4M); + } +#endif } void __init vmalloc_init(void)
Scale a zone size to number of CPUs. Each power of two value adds extra 100 * PAGE_SIZE bytes to a zone size. A maximum zone size limit is set to 4M, it is reached if number of CPUs=1024 and PAGE_SIZE=4096 bytes. For 32-bit or single core systems cvz_size is set to ULONG_MAX. It means that a pre-loading technique is deactivated. Signed-off-by: Uladzislau Rezki (Sony) <urezki@gmail.com> --- mm/vmalloc.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-)