From: "Martin J. Bligh" <fletch@aracnet.com>
To: Andrew Morton <akpm@digeo.com>
Cc: linux-mm mailing list <linux-mm@kvack.org>
Subject: [PATCH] Ensure contig page data is not define for discontigmem
Date: Sat, 21 Sep 2002 14:44:49 -0700 [thread overview]
Message-ID: <8179511.1032619489@[10.10.2.3]> (raw)
[-- Attachment #1: Type: text/plain, Size: 2475 bytes --]
This patch fixes a nasty bug that wli found in buffer.c which
cause an oops - we were using contig_page_data on a discontigmem
machine. It's a slightly modified version of the fix wli suggested,
tested on NUMA-Q.
I've also added code to not define contig_page_data for discontigmem
systems, to stop this from happening again. I wrapped a couple of
bootmem functions that were using it in #ifndef CONFIG_DISCONTIGMEM.
I suppose it's possible (though unlikely) that some other discontig
arch might need to wrap a couple of functions in their tree similarly,
but any borkage will just give a simple clear compiler error telling
them exactly where the problem is.
Inlined for easy reading, attatched as well in case life mangles
things.
diff -urN -X /home/mbligh/.diff.exclude numafixes/fs/buffer.c numafixes2/fs/buffer.c
--- numafixes/fs/buffer.c Wed Sep 18 20:41:12 2002
+++ numafixes2/fs/buffer.c Wed Sep 18 21:41:05 2002
@@ -468,12 +468,17 @@
static void free_more_memory(void)
{
struct zone *zone;
+ pg_data_t *pgdat;
- zone = contig_page_data.node_zonelists[GFP_NOFS&GFP_ZONEMASK].zones[0];
wakeup_bdflush(1024);
blk_run_queues();
yield();
- try_to_free_pages(zone, GFP_NOFS, 0);
+
+ for_each_pgdat(pgdat) {
+ zone = pgdat->node_zonelists[GFP_NOFS&GFP_ZONEMASK].zones[0];
+ if (zone)
+ try_to_free_pages(zone, GFP_NOFS, 0);
+ }
}
/*
diff -urN -X /home/mbligh/.diff.exclude numafixes/mm/bootmem.c numafixes2/mm/bootmem.c
--- numafixes/mm/bootmem.c Tue Sep 17 17:58:50
2002
+++ numafixes2/mm/bootmem.c Wed Sep 18 21:44:16 2002
@@ -311,6 +311,7 @@
return(free_all_bootmem_core(pgdat));
}
+#ifndef CONFIG_DISCONTIGMEM
unsigned long __init init_bootmem (unsigned long start, unsigned long pages)
{
max_low_pfn = pages;
@@ -334,6 +335,7 @@
{
return(free_all_bootmem_core(&contig_page_data));
}
+#endif /* !CONFIG_DISCONTIGMEM */
void * __init __alloc_bootmem (unsigned long size, unsigned long align, unsigned long goal)
{
diff -urN -X /home/mbligh/.diff.exclude numafixes/mm/numa.c numafixes2/mm/numa.c
--- numafixes/mm/numa.c Wed Sep 18 20:41:12 2002
+++ numafixes2/mm/numa.c Wed Sep 18 21:41:05 2002
@@ -11,10 +11,10 @@
int numnodes = 1; /* Initialized for UMA platforms */
+#ifndef CONFIG_DISCONTIGMEM
+
static bootmem_data_t contig_bootmem_data;
pg_data_t contig_page_data = { .bdata = &contig_bootmem_data };
-
-#ifndef CONFIG_DISCONTIGMEM
/*
* This is meant to be invoked by platforms whose physical memory starts
[-- Attachment #2: numafixes2 --]
[-- Type: application/octet-stream, Size: 1733 bytes --]
diff -urN -X /home/mbligh/.diff.exclude numafixes/fs/buffer.c numafixes2/fs/buffer.c
--- numafixes/fs/buffer.c Wed Sep 18 20:41:12 2002
+++ numafixes2/fs/buffer.c Wed Sep 18 21:41:05 2002
@@ -468,12 +468,17 @@
static void free_more_memory(void)
{
struct zone *zone;
+ pg_data_t *pgdat;
- zone = contig_page_data.node_zonelists[GFP_NOFS&GFP_ZONEMASK].zones[0];
wakeup_bdflush(1024);
blk_run_queues();
yield();
- try_to_free_pages(zone, GFP_NOFS, 0);
+
+ for_each_pgdat(pgdat) {
+ zone = pgdat->node_zonelists[GFP_NOFS&GFP_ZONEMASK].zones[0];
+ if (zone)
+ try_to_free_pages(zone, GFP_NOFS, 0);
+ }
}
/*
diff -urN -X /home/mbligh/.diff.exclude numafixes/mm/bootmem.c numafixes2/mm/bootmem.c
--- numafixes/mm/bootmem.c Tue Sep 17 17:58:50 2002
+++ numafixes2/mm/bootmem.c Wed Sep 18 21:44:16 2002
@@ -311,6 +311,7 @@
return(free_all_bootmem_core(pgdat));
}
+#ifndef CONFIG_DISCONTIGMEM
unsigned long __init init_bootmem (unsigned long start, unsigned long pages)
{
max_low_pfn = pages;
@@ -334,6 +335,7 @@
{
return(free_all_bootmem_core(&contig_page_data));
}
+#endif /* !CONFIG_DISCONTIGMEM */
void * __init __alloc_bootmem (unsigned long size, unsigned long align, unsigned long goal)
{
diff -urN -X /home/mbligh/.diff.exclude numafixes/mm/numa.c numafixes2/mm/numa.c
--- numafixes/mm/numa.c Wed Sep 18 20:41:12 2002
+++ numafixes2/mm/numa.c Wed Sep 18 21:41:05 2002
@@ -11,10 +11,10 @@
int numnodes = 1; /* Initialized for UMA platforms */
+#ifndef CONFIG_DISCONTIGMEM
+
static bootmem_data_t contig_bootmem_data;
pg_data_t contig_page_data = { .bdata = &contig_bootmem_data };
-
-#ifndef CONFIG_DISCONTIGMEM
/*
* This is meant to be invoked by platforms whose physical memory starts
reply other threads:[~2002-09-21 21:44 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='8179511.1032619489@[10.10.2.3]' \
--to=fletch@aracnet.com \
--cc=akpm@digeo.com \
--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