From: Vamshi K Sthambamkadi <vamshi.k.sthambamkadi@gmail.com>
To: akpm@linux-foundation.org
Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: [PATCH] mm/memory_hotplug: fix default_zone_for_pfn() to include highmem zone range
Date: Thu, 4 Jun 2020 19:09:42 +0530 [thread overview]
Message-ID: <20200604133938.GA1513@cosmos> (raw)
On x86_32, while onlining highmem sections, the func default_zone_for_pfn()
defaults target zone to ZONE_NORMAL (movable_node_enabled = 0). Onlining of
pages is successful, and these highmem pages are moved into zone_normal.
As a consequence, these pages are treated as low mem, and page addresses
are calculated using lowmem_page_address() which effectively overflows the
32 bit virtual addresses, leading to kernel panics and system becomes
unusable.
Change default_kernel_zone_for_pfn() to intersect highmem pfn range, and
calculate the default zone accordingly.
Signed-off-by: Vamshi K Sthambamkadi <vamshi.k.sthambamkadi@gmail.com>
---
mm/memory_hotplug.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c
index c4d5c45..30f101a 100644
--- a/mm/memory_hotplug.c
+++ b/mm/memory_hotplug.c
@@ -725,8 +725,13 @@ static struct zone *default_kernel_zone_for_pfn(int nid, unsigned long start_pfn
{
struct pglist_data *pgdat = NODE_DATA(nid);
int zid;
+ int nr_zones = ZONE_NORMAL;
- for (zid = 0; zid <= ZONE_NORMAL; zid++) {
+#ifdef CONFIG_HIGHMEM
+ nr_zones = ZONE_HIGHMEM;
+#endif
+
+ for (zid = 0; zid <= nr_zones; zid++) {
struct zone *zone = &pgdat->node_zones[zid];
if (zone_intersects(zone, start_pfn, nr_pages))
--
2.7.4
next reply other threads:[~2020-06-04 13:39 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-06-04 13:39 Vamshi K Sthambamkadi [this message]
2020-06-04 14:49 ` David Hildenbrand
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=20200604133938.GA1513@cosmos \
--to=vamshi.k.sthambamkadi@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.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