From patchwork Thu Nov 7 20:20:33 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yu Zhao X-Patchwork-Id: 13867068 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 1B536D5D688 for ; Thu, 7 Nov 2024 20:20:58 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 797166B00B1; Thu, 7 Nov 2024 15:20:55 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 746A66B00B2; Thu, 7 Nov 2024 15:20:55 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 59A776B00B3; Thu, 7 Nov 2024 15:20:55 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 30A286B00B1 for ; Thu, 7 Nov 2024 15:20:55 -0500 (EST) Received: from smtpin15.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id AE8694022E for ; Thu, 7 Nov 2024 20:20:54 +0000 (UTC) X-FDA: 82760416788.15.E04A470 Received: from mail-yw1-f201.google.com (mail-yw1-f201.google.com [209.85.128.201]) by imf20.hostedemail.com (Postfix) with ESMTP id 26F511C0012 for ; Thu, 7 Nov 2024 20:20:07 +0000 (UTC) Authentication-Results: imf20.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b=0YlZqLgX; spf=pass (imf20.hostedemail.com: domain of 3JCEtZwYKCFsRNSA3H9HH9E7.5HFEBGNQ-FFDO35D.HK9@flex--yuzhao.bounces.google.com designates 209.85.128.201 as permitted sender) smtp.mailfrom=3JCEtZwYKCFsRNSA3H9HH9E7.5HFEBGNQ-FFDO35D.HK9@flex--yuzhao.bounces.google.com; dmarc=pass (policy=reject) header.from=google.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1731010627; 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-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=RYMFXTGWFxXGTBSXbf4RqlCV7Y4+WKb9i4kIMpLBOpY=; b=WWyIdZhNthz7SVsovo4zXYl5srsU37+vGmazRmo4Boj8Z5a+RmtHS0bcxsNvvdQNSMeSRh 1y+vNDGSqDSdMLF+0EK025WZGbIuCMtV5z94Fmgo8b75jhwCDawtpKOORzjghAguy3JAan VggBOTyXRylLcoUvoPl4a1jneAnh3QA= ARC-Authentication-Results: i=1; imf20.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b=0YlZqLgX; spf=pass (imf20.hostedemail.com: domain of 3JCEtZwYKCFsRNSA3H9HH9E7.5HFEBGNQ-FFDO35D.HK9@flex--yuzhao.bounces.google.com designates 209.85.128.201 as permitted sender) smtp.mailfrom=3JCEtZwYKCFsRNSA3H9HH9E7.5HFEBGNQ-FFDO35D.HK9@flex--yuzhao.bounces.google.com; dmarc=pass (policy=reject) header.from=google.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1731010627; a=rsa-sha256; cv=none; b=r5pbx1VlFQz9urAko/KjYTZoKJHsio6cwJ+BIfdmg81iNFmGOUGfBdAM6tsv25+NkjjFHC sQg4ZhufDq/dgNFWIB/Hl1x9IMI31AklL1gl0/cqjhNWZsXui0LNxNq5lQIpHjh+hEhvc/ kPHC1Xd8UcotQgm43WGPznRkYBYDETc= Received: by mail-yw1-f201.google.com with SMTP id 00721157ae682-6e3c638cc27so26582047b3.0 for ; Thu, 07 Nov 2024 12:20:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1731010852; x=1731615652; darn=kvack.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=RYMFXTGWFxXGTBSXbf4RqlCV7Y4+WKb9i4kIMpLBOpY=; b=0YlZqLgXrv4AosQDyqd5bfZT4ehfgv6iU6iuo0o86PGMqeJkQ70t1rNCclGBG6vcP/ VlzUMdFwVQYsvyrtyUpUaVItN7aTLhsjhBRrSpLV6jV0y4iqk9zmJFj2YxABKvuzQn5+ OvlcgNheBdokSLqJdGs1mMaZH+VSY0oj0iyMh6YECwTtA6IRZPmM77vz2Nr+RluDqnJ0 m3IVjWMImYXHz0rqcyUtz5rzRC7aZ/3GcWJcqj35N9NhMVv/2oXspe+EUtrVdvvDUqga 27z0EbVa4x59bRn/uHZ1ALkZAucU47WWgioeSHwWoNQYzExmPO88CqrWpSIIbM/fFsTU 6kqQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731010852; x=1731615652; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=RYMFXTGWFxXGTBSXbf4RqlCV7Y4+WKb9i4kIMpLBOpY=; b=IosBLe8HUi/1nEG2reR2+LqkZIpc4uNRpkEMS3P9R/vfeMfi0QfIxNiTawXwtKhkeZ RLFXyFTv2ezF3SEYd76N+aLMVG2e74JMZPuG7m0rm3Fubb5Dl1yn1cMHYkoSy9G8TkM9 AsA8Wr5iTzmdTc3kc8g2TbwCYsyC2e5/7PqCqEM09TFzaRkel0KXS6/LFShj6KvCZ1sv RsSTwHKqNuWfmpIJvQrUsOoSJzxDVg5ZZmmGGWn+Ec85dguRlWOI/HhbvhKTe0E3vUul 36cn8tSYeoz8Zg2waKGVNEJfTzWflmdFetzdEJW4SgN9Na9chMY8dQ3r8Flhirj0s2Jb m4lA== X-Forwarded-Encrypted: i=1; AJvYcCXCJOp5Vt7KjdoxZBx7C1uNj7Fx3ELBdNkJgGVsfkKEpQpz0MOUUSbUELD1194jz/+rEEJkHSy4bA==@kvack.org X-Gm-Message-State: AOJu0YyZolAeC04fQa6Ui2my5aJddidrsSZC3nRN3M/5qDxbJmzw/1qH EUdg4fkfMJ67/nBU/HEwIYa/tzNgKPmM7HOTLjOWg3zHWMBxe5LlYet81r69OTezKhhgtDYhAuV V6w== X-Google-Smtp-Source: AGHT+IHlhijSC9zoCXOj87mpdA8tF9p5aSLV/movLFpBkBVUAVMMT2gDU4exk7NlnuXq35RVmXnfaJPFwyA= X-Received: from yuzhao2.bld.corp.google.com ([2a00:79e0:2e28:6:a4c0:c64f:6cdd:91f8]) (user=yuzhao job=sendgmr) by 2002:a5b:809:0:b0:e2e:3401:ea0f with SMTP id 3f1490d57ef6-e337f8f63a3mr313276.7.1731010852085; Thu, 07 Nov 2024 12:20:52 -0800 (PST) Date: Thu, 7 Nov 2024 13:20:33 -0700 In-Reply-To: <20241107202033.2721681-1-yuzhao@google.com> Mime-Version: 1.0 References: <20241107202033.2721681-1-yuzhao@google.com> X-Mailer: git-send-email 2.47.0.277.g8800431eea-goog Message-ID: <20241107202033.2721681-7-yuzhao@google.com> Subject: [PATCH v2 6/6] arm64: select ARCH_WANT_OPTIMIZE_HUGETLB_VMEMMAP From: Yu Zhao To: Andrew Morton , Catalin Marinas , Marc Zyngier , Muchun Song , Thomas Gleixner , Will Deacon Cc: Douglas Anderson , Mark Rutland , Nanyong Sun , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, Yu Zhao X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: 26F511C0012 X-Stat-Signature: aoywohntw14n36qydswsk7hegzdc7urh X-Rspam-User: X-HE-Tag: 1731010807-757896 X-HE-Meta: U2FsdGVkX1//KZ5PScrpIPKYzrUb6vkDS4x3lXZbavfODjno2KKuvEgpww5Hwt3UdQeHuOtOibl86xBGpsT7Q0clJmo3a4biK0V5SwtRzHjTZixvb4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LfF3Ok+C/Nwd7vbkrSWnwTo3BQMOtLyulg/YC8Qli9Eoj8hWvtXVHqIEveUnhY+yHAIGfW85gUPGfsxiEMfVptLqmowdAoLOsPcjz75Y4y6bwOOzB8J7zMIYzbf6oWZ5X+dVQUCTWW/AnaRt7auGhCUIsepMnHn/FW7PkvB1Msw3/3WoaDlxi2EyHQMNBXJA+eTxMwlzmzbxJwHqfxjyIY9qcVh5hGNmL4OLv4WB1jmYyO3KyhmpmR3QCixfIbZBJtW7RD0m0z0EdlTwpZbtogfcgfcGMDLwTPKU1DF7y2KnmnvC+JhOhARoXIoilR9lhxOmrpvkm1iht1o/rVip8r8wb5X7jfELN7J3tcrylNYYyztY7lwHqg/36z5XrXBf927cv3rXDIZmlyjA== 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: List-Subscribe: List-Unsubscribe: To use HVO, make sure that the kernel is booted with pseudo-NMI enabled by "irqchip.gicv3_pseudo_nmi=1", as well as "hugetlb_free_vmemmap=on" unless HVO is enabled by default. Note that HVO checks the pseudo-NMI capability and is disabled at runtime if that turns out not supported. Successfully enabling HVO should have the following: # dmesg | grep NMI GICv3: Pseudo-NMIs enabled using ... # sysctl vm.hugetlb_optimize_vmemmap vm.hugetlb_optimize_vmemmap = 1 For comparison purposes, the whole series was measured against this patch only, to show the overhead from pausing remote CPUs: HugeTLB operations This patch only The whole series Change Alloc 600 1GB 0m3.526s 0m3.649s +4% Free 600 1GB 0m0.880s 0m0.917s +4% Demote 600 1GB to 307200 2MB 0m1.575s 0m3.640s +231% Free 307200 2MB 0m0.946s 0m2.921s +309% Signed-off-by: Yu Zhao --- arch/arm64/Kconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig index fd9df6dcc593..e93745f819d9 100644 --- a/arch/arm64/Kconfig +++ b/arch/arm64/Kconfig @@ -109,6 +109,7 @@ config ARM64 select ARCH_WANT_DEFAULT_TOPDOWN_MMAP_LAYOUT select ARCH_WANT_FRAME_POINTERS select ARCH_WANT_HUGE_PMD_SHARE if ARM64_4K_PAGES || (ARM64_16K_PAGES && !ARM64_VA_BITS_36) + select ARCH_WANT_OPTIMIZE_HUGETLB_VMEMMAP select ARCH_WANT_LD_ORPHAN_WARN select ARCH_WANTS_EXECMEM_LATE if EXECMEM select ARCH_WANTS_NO_INSTR