Commit 93b7504e3e6c1d98586854806e51bea329ea3aa9
Committed by
Linus Torvalds
1 parent
0e19243e9a
Exists in
master
and in
20 other branches
[PATCH] Introduce new Kconfig option for NUMA or DISCONTIG
There is some confusion that arose when working on SPARSEMEM patch between what is needed for DISCONTIG vs. NUMA. Multiple pg_data_t's are needed for DISCONTIGMEM or NUMA, independently. All of the current NUMA implementations require an implementation of DISCONTIG. Because of this, quite a lot of code which is really needed for NUMA is actually under DISCONTIG #ifdefs. For SPARSEMEM, we changed some of these #ifdefs to CONFIG_NUMA, but that broke the DISCONTIG=y and NUMA=n case. Introducing this new NEED_MULTIPLE_NODES config option allows code that is needed for both NUMA or DISCONTIG to be separated out from code that is specific to DISCONTIG. One great advantage of this approach is that it doesn't require every architecture to be converted over. All of the current implementations should "just work", only the ones implementing SPARSEMEM will have to be fixed up. The change to free_area_init() makes it work inside, or out of the new config option. Signed-off-by: Dave Hansen <haveblue@us.ibm.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Showing 3 changed files with 14 additions and 6 deletions Side-by-side Diff
include/linux/mmzone.h
... | ... | @@ -402,7 +402,7 @@ |
402 | 402 | /* Returns the number of the current Node. */ |
403 | 403 | #define numa_node_id() (cpu_to_node(raw_smp_processor_id())) |
404 | 404 | |
405 | -#ifndef CONFIG_DISCONTIGMEM | |
405 | +#ifndef CONFIG_NEED_MULTIPLE_NODES | |
406 | 406 | |
407 | 407 | extern struct pglist_data contig_page_data; |
408 | 408 | #define NODE_DATA(nid) (&contig_page_data) |
409 | 409 | |
... | ... | @@ -410,11 +410,11 @@ |
410 | 410 | #define MAX_NODES_SHIFT 1 |
411 | 411 | #define pfn_to_nid(pfn) (0) |
412 | 412 | |
413 | -#else /* CONFIG_DISCONTIGMEM */ | |
413 | +#else /* CONFIG_NEED_MULTIPLE_NODES */ | |
414 | 414 | |
415 | 415 | #include <asm/mmzone.h> |
416 | 416 | |
417 | -#endif /* !CONFIG_DISCONTIGMEM */ | |
417 | +#endif /* !CONFIG_NEED_MULTIPLE_NODES */ | |
418 | 418 | |
419 | 419 | #if BITS_PER_LONG == 32 || defined(ARCH_HAS_ATOMIC_UNSIGNED) |
420 | 420 | /* |
mm/Kconfig
... | ... | @@ -22,4 +22,13 @@ |
22 | 22 | If unsure, choose "Flat Memory" over this option. |
23 | 23 | |
24 | 24 | endchoice |
25 | + | |
26 | +# | |
27 | +# Both the NUMA code and DISCONTIGMEM use arrays of pg_data_t's | |
28 | +# to represent different areas of memory. This variable allows | |
29 | +# those dependencies to exist individually. | |
30 | +# | |
31 | +config NEED_MULTIPLE_NODES | |
32 | + def_bool y | |
33 | + depends on DISCONTIGMEM || NUMA |
mm/page_alloc.c
... | ... | @@ -1972,18 +1972,18 @@ |
1972 | 1972 | free_area_init_core(pgdat, zones_size, zholes_size); |
1973 | 1973 | } |
1974 | 1974 | |
1975 | -#ifndef CONFIG_DISCONTIGMEM | |
1975 | +#ifndef CONFIG_NEED_MULTIPLE_NODES | |
1976 | 1976 | static bootmem_data_t contig_bootmem_data; |
1977 | 1977 | struct pglist_data contig_page_data = { .bdata = &contig_bootmem_data }; |
1978 | 1978 | |
1979 | 1979 | EXPORT_SYMBOL(contig_page_data); |
1980 | +#endif | |
1980 | 1981 | |
1981 | 1982 | void __init free_area_init(unsigned long *zones_size) |
1982 | 1983 | { |
1983 | - free_area_init_node(0, &contig_page_data, zones_size, | |
1984 | + free_area_init_node(0, NODE_DATA(0), zones_size, | |
1984 | 1985 | __pa(PAGE_OFFSET) >> PAGE_SHIFT, NULL); |
1985 | 1986 | } |
1986 | -#endif | |
1987 | 1987 | |
1988 | 1988 | #ifdef CONFIG_PROC_FS |
1989 | 1989 |