From: Yu Zhao <yuzhao@google.com>
To: Andrew Morton <akpm@linux-foundation.org>,
Catalin Marinas <catalin.marinas@arm.com>,
Marc Zyngier <maz@kernel.org>,
Muchun Song <muchun.song@linux.dev>,
Thomas Gleixner <tglx@linutronix.de>,
Will Deacon <will@kernel.org>
Cc: Douglas Anderson <dianders@chromium.org>,
Mark Rutland <mark.rutland@arm.com>,
Nanyong Sun <sunnanyong@huawei.com>,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, linux-mm@kvack.org,
Yu Zhao <yuzhao@google.com>
Subject: [PATCH v2 0/6] mm/arm64: re-enable HVO
Date: Thu, 7 Nov 2024 13:20:27 -0700 [thread overview]
Message-ID: <20241107202033.2721681-1-yuzhao@google.com> (raw)
HVO was disabled by commit 060a2c92d1b6 ("arm64: mm: hugetlb: Disable
HUGETLB_PAGE_OPTIMIZE_VMEMMAP") due to the following reason:
This is deemed UNPREDICTABLE by the Arm architecture without a
break-before-make sequence (make the PTE invalid, TLBI, write the
new valid PTE). However, such sequence is not possible since the
vmemmap may be concurrently accessed by the kernel.
This series presents one of the previously discussed approaches to
re-enable HugeTLB Vmemmap Optimization (HVO) on arm64. Other
approaches that have been discussed include:
A. Handle kernel PF while doing BBM [1],
B. Use stop_machine() while doing BBM [2], and,
C. Enable FEAT_BBM level 2 and keep the memory contents at the old
and new output addresses unchanged to avoid BBM (D8.16.1-2) [3].
A quick comparison between this approach (D) and the above approaches:
--+------------------------------+-----------------------------+
| Pros | Cons |
--+------------------------------+-----------------------------+
A | Low latency, h/w independent | Predictability concerns [4] |
B | Predictable, h/w independent | High latency |
C | Predictable, low latency | H/w dependent, complex |
D | Predictable, h/w independent | Medium latency |
--+------------------------------+-----------------------------+
This approach is being tested for Google's production systems, which
generally find the "cons" above acceptable, making it the preferred
trade-off for our use cases:
+------------------------------+------------+----------+--------+
| HugeTLB operations | Before [0] + After | 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% |
+------------------------------+------------+----------+--------+
[0] For comparison purposes, this only includes the last patch in the
series, i.e., CONFIG_ARCH_WANT_OPTIMIZE_HUGETLB_VMEMMAP=y.
[1] https://lore.kernel.org/20240113094436.2506396-1-sunnanyong@huawei.com/
[2] https://lore.kernel.org/ZbKjHHeEdFYY1xR5@arm.com/
[3] https://lore.kernel.org/Zo68DP6siXfb6ZBR@arm.com/
[4] https://lore.kernel.org/20240326125409.GA9552@willie-the-truck/
Major changes from v1, based on Marc Zyngier's help:
1. Switched from CPU masks to a counter when pausing remote CPUs.
2. Removed unnecessary memory barriers.
Yu Zhao (6):
mm/hugetlb_vmemmap: batch-update PTEs
mm/hugetlb_vmemmap: add arch-independent helpers
irqchip/gic-v3: support SGI broadcast
arm64: broadcast IPIs to pause remote CPUs
arm64: pause remote CPUs to update vmemmap
arm64: select ARCH_WANT_OPTIMIZE_HUGETLB_VMEMMAP
arch/arm64/Kconfig | 1 +
arch/arm64/include/asm/pgalloc.h | 69 ++++++++
arch/arm64/include/asm/smp.h | 3 +
arch/arm64/kernel/smp.c | 85 +++++++++-
drivers/irqchip/irq-gic-v3.c | 31 +++-
include/linux/mm_types.h | 7 +
mm/hugetlb_vmemmap.c | 262 +++++++++++++++++++++----------
7 files changed, 362 insertions(+), 96 deletions(-)
base-commit: 80fb25341631b75f57b84f99cc35b95ca2aad329
--
2.47.0.277.g8800431eea-goog
next reply other threads:[~2024-11-07 20:20 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-07 20:20 Yu Zhao [this message]
2024-11-07 20:20 ` [PATCH v2 1/6] mm/hugetlb_vmemmap: batch-update PTEs Yu Zhao
2024-11-07 20:20 ` [PATCH v2 2/6] mm/hugetlb_vmemmap: add arch-independent helpers Yu Zhao
2024-11-07 20:20 ` [PATCH v2 3/6] irqchip/gic-v3: support SGI broadcast Yu Zhao
2024-11-07 20:20 ` [PATCH v2 4/6] arm64: broadcast IPIs to pause remote CPUs Yu Zhao
2024-11-07 20:20 ` [PATCH v2 5/6] arm64: pause remote CPUs to update vmemmap Yu Zhao
2024-11-07 20:20 ` [PATCH v2 6/6] arm64: select ARCH_WANT_OPTIMIZE_HUGETLB_VMEMMAP Yu Zhao
2024-11-25 15:22 ` [PATCH v2 0/6] mm/arm64: re-enable HVO Will Deacon
2024-11-25 22:22 ` Yu Zhao
2024-11-28 14:20 ` Will Deacon
2025-01-07 6:07 ` Yu Zhao
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20241107202033.2721681-1-yuzhao@google.com \
--to=yuzhao@google.com \
--cc=akpm@linux-foundation.org \
--cc=catalin.marinas@arm.com \
--cc=dianders@chromium.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mark.rutland@arm.com \
--cc=maz@kernel.org \
--cc=muchun.song@linux.dev \
--cc=sunnanyong@huawei.com \
--cc=tglx@linutronix.de \
--cc=will@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox