From: Serge Semin <fancer.lancer@gmail.com>
To: Ralf Baechle <ralf@linux-mips.org>,
Paul Burton <paul.burton@mips.com>,
James Hogan <jhogan@kernel.org>,
Matt Redfearn <matt.redfearn@mips.com>,
Mike Rapoport <rppt@linux.ibm.com>,
Andrew Morton <akpm@linux-foundation.org>,
Michal Hocko <mhocko@suse.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Thomas Bogendoerfer <tbogendoerfer@suse.de>,
Huacai Chen <chenhc@lemote.com>, Stefan Agner <stefan@agner.ch>,
Stephen Rothwell <sfr@canb.auug.org.au>,
Alexandre Belloni <alexandre.belloni@bootlin.com>,
Juergen Gross <jgross@suse.com>
Cc: linux-mips@vger.kernel.org, linux-kernel@vger.kernel.org,
Serge Semin <fancer.lancer@gmail.com>
Subject: [PATCH 02/12] mips: Discard rudiments from bootmem_init
Date: Wed, 24 Apr 2019 01:47:38 +0300 [thread overview]
Message-ID: <20190423224748.3765-3-fancer.lancer@gmail.com> (raw)
In-Reply-To: <20190423224748.3765-1-fancer.lancer@gmail.com>
There is a pointless code left in the bootmem_init() method since
the bootmem allocator removal. First part resides the PFN ranges
calculation loop. The conditional expressions and continue operator
are useless there, since nothing is done after them. Second part is
in RAM ranges installation loop. We can simplify the conditions cascade
a bit without much of the logic redefinition, so to reduce the code
length. In particular the end boundary value can be verified after
the possible reduction to be below max_low_pfn.
Signed-off-by: Serge Semin <fancer.lancer@gmail.com>
---
arch/mips/kernel/setup.c | 25 +++++--------------------
1 file changed, 5 insertions(+), 20 deletions(-)
diff --git a/arch/mips/kernel/setup.c b/arch/mips/kernel/setup.c
index 0ee033c44116..53d93a727d1a 100644
--- a/arch/mips/kernel/setup.c
+++ b/arch/mips/kernel/setup.c
@@ -394,10 +394,7 @@ static void __init bootmem_init(void)
min_low_pfn = ~0UL;
max_low_pfn = 0;
- /*
- * Find the highest page frame number we have available
- * and the lowest used RAM address
- */
+ /* Find the highest and lowest page frame numbers we have available. */
for (i = 0; i < boot_mem_map.nr_map; i++) {
unsigned long start, end;
@@ -427,13 +424,6 @@ static void __init bootmem_init(void)
max_low_pfn = end;
if (start < min_low_pfn)
min_low_pfn = start;
- if (end <= reserved_end)
- continue;
-#ifdef CONFIG_BLK_DEV_INITRD
- /* Skip zones before initrd and initrd itself */
- if (initrd_end && end <= (unsigned long)PFN_UP(__pa(initrd_end)))
- continue;
-#endif
}
if (min_low_pfn >= max_low_pfn)
@@ -474,6 +464,7 @@ static void __init bootmem_init(void)
max_low_pfn = PFN_DOWN(HIGHMEM_START);
}
+ /* Install all valid RAM ranges to the memblock memory region */
for (i = 0; i < boot_mem_map.nr_map; i++) {
unsigned long start, end;
@@ -481,21 +472,15 @@ static void __init bootmem_init(void)
end = PFN_DOWN(boot_mem_map.map[i].addr
+ boot_mem_map.map[i].size);
- if (start <= min_low_pfn)
+ if (start < min_low_pfn)
start = min_low_pfn;
- if (start >= end)
- continue;
-
#ifndef CONFIG_HIGHMEM
+ /* Ignore highmem regions if highmem is unsupported */
if (end > max_low_pfn)
end = max_low_pfn;
-
- /*
- * ... finally, is the area going away?
- */
+#endif
if (end <= start)
continue;
-#endif
memblock_add_node(PFN_PHYS(start), PFN_PHYS(end - start), 0);
}
--
2.21.0
next prev parent reply other threads:[~2019-04-23 22:50 UTC|newest]
Thread overview: 43+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-04-23 22:47 [PATCH 00/12] mips: Post-bootmem-memblock transition fixes Serge Semin
2019-04-23 22:47 ` [PATCH 01/12] mips: Make sure kernel .bss exists in boot mem pool Serge Semin
2019-04-24 22:30 ` Paul Burton
2019-04-23 22:47 ` Serge Semin [this message]
2019-04-24 22:30 ` [PATCH 02/12] mips: Discard rudiments from bootmem_init Paul Burton
2019-04-23 22:47 ` [PATCH 03/12] mips: Combine memblock init and memory reservation loops Serge Semin
2019-04-24 22:30 ` Paul Burton
2019-04-23 22:47 ` [PATCH 04/12] mips: Reserve memory for the kernel image resources Serge Semin
2019-04-24 22:43 ` Paul Burton
2019-04-26 0:00 ` Serge Semin
2019-04-30 22:58 ` Paul Burton
2019-05-02 14:24 ` Serge Semin
2019-05-02 18:45 ` Paul Burton
2019-05-03 17:21 ` Serge Semin
2019-05-02 18:35 ` Paul Burton
2019-05-21 14:56 ` Geert Uytterhoeven
2019-05-21 15:53 ` Mike Rapoport
2019-05-21 16:39 ` Serge Semin
2019-05-22 7:50 ` Geert Uytterhoeven
2019-05-22 7:47 ` Geert Uytterhoeven
2019-05-22 8:08 ` Mike Rapoport
2019-05-22 8:14 ` Geert Uytterhoeven
2019-05-22 13:34 ` Serge Semin
2019-05-22 13:44 ` Geert Uytterhoeven
2019-05-22 13:54 ` Serge Semin
2020-10-14 9:49 ` Maciej W. Rozycki
2019-04-23 22:47 ` [PATCH 05/12] mips: Discard post-CMA-init foreach loop Serge Semin
2019-05-02 18:35 ` Paul Burton
2019-04-23 22:47 ` [PATCH 06/12] mips: Use memblock to reserve the __nosave memory range Serge Semin
2019-05-02 18:35 ` Paul Burton
2019-04-23 22:47 ` [PATCH 07/12] mips: Add reserve-nomap memory type support Serge Semin
2019-05-02 18:35 ` Paul Burton
2019-04-23 22:47 ` [PATCH 08/12] mips: Dump memblock regions for debugging Serge Semin
2019-04-24 13:45 ` Mike Rapoport
2019-04-24 14:20 ` Serge Semin
2019-04-23 22:47 ` [PATCH 09/12] mips: Perform early low memory test Serge Semin
2019-04-23 22:47 ` [PATCH 10/12] mips: Print the kernel virtual mem layout on debugging Serge Semin
2019-04-24 13:47 ` Mike Rapoport
2019-04-24 14:35 ` Serge Semin
2019-04-23 22:47 ` [PATCH 11/12] mips: Make sure dt memory regions are valid Serge Semin
2019-04-23 22:47 ` [PATCH 12/12] mips: Enable OF_RESERVED_MEM config Serge Semin
2019-04-24 6:17 ` Christoph Hellwig
2019-04-24 8:34 ` Serge Semin
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=20190423224748.3765-3-fancer.lancer@gmail.com \
--to=fancer.lancer@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=alexandre.belloni@bootlin.com \
--cc=chenhc@lemote.com \
--cc=gregkh@linuxfoundation.org \
--cc=jgross@suse.com \
--cc=jhogan@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mips@vger.kernel.org \
--cc=matt.redfearn@mips.com \
--cc=mhocko@suse.com \
--cc=paul.burton@mips.com \
--cc=ralf@linux-mips.org \
--cc=rppt@linux.ibm.com \
--cc=sfr@canb.auug.org.au \
--cc=stefan@agner.ch \
--cc=tbogendoerfer@suse.de \
/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;
as well as URLs for NNTP newsgroup(s).