diff options
author | Ingo Molnar <mingo@kernel.org> | 2017-11-06 03:49:28 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2017-11-06 03:49:28 -0500 |
commit | 75ec4eb3dc84ee78533bd59bbb71992187bd86fd (patch) | |
tree | b75afe1763e5a21bfe508301562c037fbae2b04d /mm/sparse.c | |
parent | 19c5787a5ff88a959e5854ab6ddef7f5777c5837 (diff) | |
parent | 15670bfe19905b1dcbb63137f40d718b59d84479 (diff) |
Merge branch 'x86/mm' into x86/asm, to pick up pending changes
Concentrate x86 MM and asm related changes into a single super-topic,
in preparation for larger changes.
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'mm/sparse.c')
-rw-r--r-- | mm/sparse.c | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/mm/sparse.c b/mm/sparse.c index 83b3bf6461af..b00a97398795 100644 --- a/mm/sparse.c +++ b/mm/sparse.c | |||
@@ -22,8 +22,7 @@ | |||
22 | * 1) mem_section - memory sections, mem_map's for valid memory | 22 | * 1) mem_section - memory sections, mem_map's for valid memory |
23 | */ | 23 | */ |
24 | #ifdef CONFIG_SPARSEMEM_EXTREME | 24 | #ifdef CONFIG_SPARSEMEM_EXTREME |
25 | struct mem_section *mem_section[NR_SECTION_ROOTS] | 25 | struct mem_section **mem_section; |
26 | ____cacheline_internodealigned_in_smp; | ||
27 | #else | 26 | #else |
28 | struct mem_section mem_section[NR_SECTION_ROOTS][SECTIONS_PER_ROOT] | 27 | struct mem_section mem_section[NR_SECTION_ROOTS][SECTIONS_PER_ROOT] |
29 | ____cacheline_internodealigned_in_smp; | 28 | ____cacheline_internodealigned_in_smp; |
@@ -100,7 +99,7 @@ static inline int sparse_index_init(unsigned long section_nr, int nid) | |||
100 | int __section_nr(struct mem_section* ms) | 99 | int __section_nr(struct mem_section* ms) |
101 | { | 100 | { |
102 | unsigned long root_nr; | 101 | unsigned long root_nr; |
103 | struct mem_section* root; | 102 | struct mem_section *root = NULL; |
104 | 103 | ||
105 | for (root_nr = 0; root_nr < NR_SECTION_ROOTS; root_nr++) { | 104 | for (root_nr = 0; root_nr < NR_SECTION_ROOTS; root_nr++) { |
106 | root = __nr_to_section(root_nr * SECTIONS_PER_ROOT); | 105 | root = __nr_to_section(root_nr * SECTIONS_PER_ROOT); |
@@ -111,7 +110,7 @@ int __section_nr(struct mem_section* ms) | |||
111 | break; | 110 | break; |
112 | } | 111 | } |
113 | 112 | ||
114 | VM_BUG_ON(root_nr == NR_SECTION_ROOTS); | 113 | VM_BUG_ON(!root); |
115 | 114 | ||
116 | return (root_nr * SECTIONS_PER_ROOT) + (ms - root); | 115 | return (root_nr * SECTIONS_PER_ROOT) + (ms - root); |
117 | } | 116 | } |
@@ -329,11 +328,17 @@ again: | |||
329 | static void __init check_usemap_section_nr(int nid, unsigned long *usemap) | 328 | static void __init check_usemap_section_nr(int nid, unsigned long *usemap) |
330 | { | 329 | { |
331 | unsigned long usemap_snr, pgdat_snr; | 330 | unsigned long usemap_snr, pgdat_snr; |
332 | static unsigned long old_usemap_snr = NR_MEM_SECTIONS; | 331 | static unsigned long old_usemap_snr; |
333 | static unsigned long old_pgdat_snr = NR_MEM_SECTIONS; | 332 | static unsigned long old_pgdat_snr; |
334 | struct pglist_data *pgdat = NODE_DATA(nid); | 333 | struct pglist_data *pgdat = NODE_DATA(nid); |
335 | int usemap_nid; | 334 | int usemap_nid; |
336 | 335 | ||
336 | /* First call */ | ||
337 | if (!old_usemap_snr) { | ||
338 | old_usemap_snr = NR_MEM_SECTIONS; | ||
339 | old_pgdat_snr = NR_MEM_SECTIONS; | ||
340 | } | ||
341 | |||
337 | usemap_snr = pfn_to_section_nr(__pa(usemap) >> PAGE_SHIFT); | 342 | usemap_snr = pfn_to_section_nr(__pa(usemap) >> PAGE_SHIFT); |
338 | pgdat_snr = pfn_to_section_nr(__pa(pgdat) >> PAGE_SHIFT); | 343 | pgdat_snr = pfn_to_section_nr(__pa(pgdat) >> PAGE_SHIFT); |
339 | if (usemap_snr == pgdat_snr) | 344 | if (usemap_snr == pgdat_snr) |