* mem_map definition / declaration.
@ 2006-05-31 16:23 Ralf Baechle
2006-05-31 17:00 ` Andy Whitcroft
0 siblings, 1 reply; 4+ messages in thread
From: Ralf Baechle @ 2006-05-31 16:23 UTC (permalink / raw)
To: linux-kernel, Andrew Morton, Chad Reese
mm/memory defines mem_map and max_mapnr only if !CONFIG_NEED_MULTIPLE_NODES.
<linux/mm.h> declares mem_map[] if !CONFIG_DISCONTIGMEM. Shouldn't
both depend on !CONFIG_FLATMEM? As things are now mem_map may be
declared but not defined for a non-NUMA sparsemem system which may make
tracking a remaining mem_map reference in the code a little harder.
Ralf
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: mem_map definition / declaration.
2006-05-31 16:23 mem_map definition / declaration Ralf Baechle
@ 2006-05-31 17:00 ` Andy Whitcroft
2006-06-09 13:48 ` [PATCH] mem_map is part of the FLATMEM model Andy Whitcroft
0 siblings, 1 reply; 4+ messages in thread
From: Andy Whitcroft @ 2006-05-31 17:00 UTC (permalink / raw)
To: Ralf Baechle; +Cc: linux-kernel, Andrew Morton, Chad Reese
Ralf Baechle wrote:
> mm/memory defines mem_map and max_mapnr only if !CONFIG_NEED_MULTIPLE_NODES.
> <linux/mm.h> declares mem_map[] if !CONFIG_DISCONTIGMEM. Shouldn't
> both depend on !CONFIG_FLATMEM? As things are now mem_map may be
> declared but not defined for a non-NUMA sparsemem system which may make
> tracking a remaining mem_map reference in the code a little harder.
Sounds suspect for sure. I will take a look and see. Thanks for the
head up.
-apw
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH] mem_map is part of the FLATMEM model
2006-05-31 17:00 ` Andy Whitcroft
@ 2006-06-09 13:48 ` Andy Whitcroft
2006-06-10 0:23 ` Andrew Morton
0 siblings, 1 reply; 4+ messages in thread
From: Andy Whitcroft @ 2006-06-09 13:48 UTC (permalink / raw)
To: Ralf Baechle; +Cc: linux-kernel, Andrew Morton, Chad Reese, Andy Whitcroft
As Ralf Baechle points out the definition and the declaration of
mem_map are made under differing config options. This leads to
difficulty tracking errant references to mem_map when it is not
available. Below is a patch to sort out the mem_map definition,
making the fact that it is part of the FLATMEM memory model explicit.
It builds and boots on all my test boxes. It build tests for
all sane combinations of memory model on x86. The most likely
architecture to have trouble with this is arm as it makes significant
use of mem_map, but as far as I know it uses FLATMEM and should
be fine. Testing there would be helpful.
-apw
=== 8< ===
mem_map is part of the FLATMEM model
It seems that the definition and declaration of mem_map are
inconsistent meaning we get usless undirected link failures about
mem_map when its being used when it shouldn't be.
Reviewing mem_map, its actually only valid and initialised when
CONFIG_FLATMEM is defined. Indeed in all essence it is part
of that memory model used out of FLATMEM's __pfn_to_page etc.
mem_map (and max_mapnr) should only be defined and declared when
the FLATMEM memory model is selected.
Signed-off-by: Andy Whitcroft <apw@shadowen.org>
---
include/linux/mm.h | 6 +++---
include/linux/mmzone.h | 5 ++++-
mm/memory.c | 2 +-
3 files changed, 8 insertions(+), 5 deletions(-)
diff -upN reference/include/linux/mm.h current/include/linux/mm.h
--- reference/include/linux/mm.h
+++ current/include/linux/mm.h
@@ -19,7 +19,7 @@
struct mempolicy;
struct anon_vma;
-#ifndef CONFIG_DISCONTIGMEM /* Don't use mapnrs, do it properly */
+#ifdef CONFIG_FLATMEM /* Don't use mapnrs, do it properly */
extern unsigned long max_mapnr;
#endif
@@ -529,8 +529,8 @@ static inline void set_page_links(struct
set_page_section(page, pfn_to_section_nr(pfn));
}
-#ifndef CONFIG_DISCONTIGMEM
-/* The array of struct pages - for discontigmem use pgdat->lmem_map */
+#ifdef CONFIG_FLATMEM
+/* The array of struct pages, only used in FLATMEM */
extern struct page *mem_map;
#endif
diff -upN reference/include/linux/mmzone.h current/include/linux/mmzone.h
--- reference/include/linux/mmzone.h
+++ current/include/linux/mmzone.h
@@ -424,11 +424,14 @@ int percpu_pagelist_fraction_sysctl_hand
#define numa_node_id() (cpu_to_node(raw_smp_processor_id()))
#endif
+#ifdef CONFIG_FLATMEM
+#define NODE_MEM_MAP(nid) mem_map
+#endif
+
#ifndef CONFIG_NEED_MULTIPLE_NODES
extern struct pglist_data contig_page_data;
#define NODE_DATA(nid) (&contig_page_data)
-#define NODE_MEM_MAP(nid) mem_map
#define MAX_NODES_SHIFT 1
#else /* CONFIG_NEED_MULTIPLE_NODES */
diff -upN reference/mm/memory.c current/mm/memory.c
--- reference/mm/memory.c
+++ current/mm/memory.c
@@ -59,7 +59,7 @@
#include <linux/swapops.h>
#include <linux/elf.h>
-#ifndef CONFIG_NEED_MULTIPLE_NODES
+#ifdef CONFIG_FLATMEM
/* use the per-pgdat data instead for discontigmem - mbligh */
unsigned long max_mapnr;
struct page *mem_map;
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] mem_map is part of the FLATMEM model
2006-06-09 13:48 ` [PATCH] mem_map is part of the FLATMEM model Andy Whitcroft
@ 2006-06-10 0:23 ` Andrew Morton
0 siblings, 0 replies; 4+ messages in thread
From: Andrew Morton @ 2006-06-10 0:23 UTC (permalink / raw)
To: Andy Whitcroft; +Cc: ralf, linux-kernel, creese, apw
Andy Whitcroft <apw@shadowen.org> wrote:
>
> mem_map is part of the FLATMEM model
>
> It seems that the definition and declaration of mem_map are
> inconsistent meaning we get usless undirected link failures about
> mem_map when its being used when it shouldn't be.
>
> Reviewing mem_map, its actually only valid and initialised when
> CONFIG_FLATMEM is defined. Indeed in all essence it is part
> of that memory model used out of FLATMEM's __pfn_to_page etc.
> mem_map (and max_mapnr) should only be defined and declared when
> the FLATMEM memory model is selected.
sparc64 allmodconfig:
arch/sparc64/mm/init.c: In function `paging_init':
arch/sparc64/mm/init.c:1339: error: `max_mapnr' undeclared (first use in this function)
arch/sparc64/mm/init.c:1339: error: (Each undeclared identifier is reported only once
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2006-06-10 0:20 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-05-31 16:23 mem_map definition / declaration Ralf Baechle
2006-05-31 17:00 ` Andy Whitcroft
2006-06-09 13:48 ` [PATCH] mem_map is part of the FLATMEM model Andy Whitcroft
2006-06-10 0:23 ` Andrew Morton
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox