From: Andrew Morton <akpm@linux-foundation.org>
To: mm-commits@vger.kernel.org, wangkefeng.wang@huawei.com,
rppt@kernel.org, ppbuk5246@gmail.com, mawupeng1@huawei.com,
akpm@linux-foundation.org
Subject: [merged mm-stable] mm-disable-kernelcore=mirror-when-no-mirror-memory.patch removed from -mm tree
Date: Mon, 21 Aug 2023 13:40:24 -0700 [thread overview]
Message-ID: <20230821204024.96E3BC433C7@smtp.kernel.org> (raw)
The quilt patch titled
Subject: mm: disable kernelcore=mirror when no mirror memory
has been removed from the -mm tree. Its filename was
mm-disable-kernelcore=mirror-when-no-mirror-memory.patch
This patch was dropped because it was merged into the mm-stable branch
of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
------------------------------------------------------
From: Ma Wupeng <mawupeng1@huawei.com>
Subject: mm: disable kernelcore=mirror when no mirror memory
Date: Wed, 2 Aug 2023 15:23:28 +0800
For system with kernelcore=mirror enabled while no mirrored memory is
reported by efi. This could lead to kernel OOM during startup since all
memory beside zone DMA are in the movable zone and this prevents the
kernel to use it.
Zone DMA/DMA32 initialization is independent of mirrored memory and their
max pfn is set in zone_sizes_init(). Since kernel can fallback to zone
DMA/DMA32 if there is no memory in zone Normal, these zones are seen as
mirrored memory no mather their memory attributes are.
To solve this problem, disable kernelcore=mirror when there is no real
mirrored memory exists.
Link: https://lkml.kernel.org/r/20230802072328.2107981-1-mawupeng1@huawei.com
Signed-off-by: Ma Wupeng <mawupeng1@huawei.com>
Suggested-by: Kefeng Wang <wangkefeng.wang@huawei.com>
Suggested-by: Mike Rapoport <rppt@kernel.org>
Reviewed-by: Mike Rapoport (IBM) <rppt@kernel.org>
Reviewed-by: Kefeng Wang <wangkefeng.wang@huawei.com>
Cc: Levi Yun <ppbuk5246@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---
mm/internal.h | 1 +
mm/memblock.c | 5 +++++
mm/mm_init.c | 5 +++++
3 files changed, 11 insertions(+)
--- a/mm/internal.h~mm-disable-kernelcore=mirror-when-no-mirror-memory
+++ a/mm/internal.h
@@ -1022,6 +1022,7 @@ static inline bool gup_must_unshare(stru
}
extern bool mirrored_kernelcore;
+extern bool memblock_has_mirror(void);
static inline bool vma_soft_dirty_enabled(struct vm_area_struct *vma)
{
--- a/mm/memblock.c~mm-disable-kernelcore=mirror-when-no-mirror-memory
+++ a/mm/memblock.c
@@ -161,6 +161,11 @@ static int memblock_can_resize __initdat
static int memblock_memory_in_slab __initdata_memblock;
static int memblock_reserved_in_slab __initdata_memblock;
+bool __init_memblock memblock_has_mirror(void)
+{
+ return system_has_some_mirror;
+}
+
static enum memblock_flags __init_memblock choose_memblock_flags(void)
{
return system_has_some_mirror ? MEMBLOCK_MIRROR : MEMBLOCK_NONE;
--- a/mm/mm_init.c~mm-disable-kernelcore=mirror-when-no-mirror-memory
+++ a/mm/mm_init.c
@@ -376,6 +376,11 @@ static void __init find_zone_movable_pfn
if (mirrored_kernelcore) {
bool mem_below_4gb_not_mirrored = false;
+ if (!memblock_has_mirror()) {
+ pr_warn("The system has no mirror memory, ignore kernelcore=mirror.\n");
+ goto out;
+ }
+
for_each_mem_region(r) {
if (memblock_is_mirror(r))
continue;
_
Patches currently in -mm which might be from mawupeng1@huawei.com are
reply other threads:[~2023-08-21 20:41 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20230821204024.96E3BC433C7@smtp.kernel.org \
--to=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mawupeng1@huawei.com \
--cc=mm-commits@vger.kernel.org \
--cc=ppbuk5246@gmail.com \
--cc=rppt@kernel.org \
--cc=wangkefeng.wang@huawei.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.