From: Faiyaz Mohammed <quic_faiyazm@quicinc.com>
To: <quic_vjitta@quicinc.com>, <karahmed@amazon.de>,
<qperret@google.com>, <robh@kernel.org>, <rppt@kernel.org>,
<akpm@linux-foundation.org>, <linux-mm@kvack.org>,
<linux-kernel@vger.kernel.org>
Cc: Faiyaz Mohammed <quic_faiyazm@quicinc.com>
Subject: [PATCH] mm: memblock: avoid to create memmap for memblock nomap regions
Date: Tue, 12 Apr 2022 00:39:32 +0530 [thread overview]
Message-ID: <1649704172-13181-1-git-send-email-quic_faiyazm@quicinc.com> (raw)
This 'commit 86588296acbf ("fdt: Properly handle "no-map" field in the
memory region")' is keeping the no-map regions in memblock.memory with
MEMBLOCK_NOMAP flag set to use no-map memory for EFI using memblock api's,
but during the initialization sparse_init mark all memblock.memory as
present using for_each_mem_pfn_range, which is creating the memmap for
no-map memblock regions. To avoid it skiping the memblock.memory regions
set with MEMBLOCK_NOMAP set and with this change we will be able to save
~11MB memory for ~612MB carve out.
With change:
[ 0.000000] memblock_alloc_exact_nid_raw: 115343360 bytes align=0x200000 nid=0 from=0x0000000080000000 max_addr=0x0000000000000000 sparse_buffer_init+0x60/0x8c
[ 0.000000] memblock_reserve: [0x0000000932c00000-0x00000009399fffff] memblock_alloc_range_nid+0xbc/0x1a0
[ 0.000000] On node 0 totalpages: 1627824
[ 0.000000] DMA32 zone: 5383 pages used for memmap
[ 0.000000] Normal zone: 20052 pages used for memmap
Without change:
[ 0.000000] memblock_alloc_exact_nid_raw: 117440512 bytes align=0x200000 nid=0 from=0x0000000080000000 max_addr=0x0000000000000000 sparse_buffer_init+0x60/0x8c
[ 0.000000] memblock_reserve: [0x0000000932a00000-0x00000009399fffff] memblock_alloc_range_nid+0xbc/0x1a0
[ 0.000000] On node 0 totalpages: 1788416
[ 0.000000] DMA32 zone: 8192 pages used for memmap
[ 0.000000] Normal zone: 20052 pages used for memmap.
Signed-off-by: Faiyaz Mohammed <quic_faiyazm@quicinc.com>
---
mm/memblock.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/mm/memblock.c b/mm/memblock.c
index 2270e3c..a4fde9d 100644
--- a/mm/memblock.c
+++ b/mm/memblock.c
@@ -1175,8 +1175,13 @@ void __init_memblock __next_mem_pfn_range(int *idx, int nid,
r = &type->regions[*idx];
r_nid = memblock_get_region_node(r);
+ /* If memblock region is nomap then skip the region. */
+ if (memblock_is_nomap(r))
+ continue;
+
if (PFN_UP(r->base) >= PFN_DOWN(r->base + r->size))
continue;
+
if (nid == MAX_NUMNODES || nid == r_nid)
break;
}
--
2.7.4
next reply other threads:[~2022-04-11 19:09 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-11 19:09 Faiyaz Mohammed [this message]
2022-04-12 17:26 ` Mike Rapoport
2022-05-05 15:16 ` Faiyaz Mohammed
2022-05-05 15:31 ` Rob Herring
2022-05-05 16:54 ` Mike Rapoport
2022-05-09 11:07 ` Faiyaz Mohammed
2022-05-09 11:42 ` Mike Rapoport
2022-08-03 10:57 ` Vijayanand Jitta
2022-08-05 19:22 ` Mike Rapoport
2024-02-08 6:37 ` Aiqun Yu (Maria)
2024-02-14 7:43 ` Mike Rapoport
2024-02-14 8:11 ` Dmitry Baryshkov
2024-02-14 9:15 ` Mike Rapoport
2024-02-20 6:28 ` Aiqun Yu (Maria)
2024-02-27 10:00 ` Mike Rapoport
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=1649704172-13181-1-git-send-email-quic_faiyazm@quicinc.com \
--to=quic_faiyazm@quicinc.com \
--cc=akpm@linux-foundation.org \
--cc=karahmed@amazon.de \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=qperret@google.com \
--cc=quic_vjitta@quicinc.com \
--cc=robh@kernel.org \
--cc=rppt@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