diff options
Diffstat (limited to 'mm/sparse.c')
-rw-r--r-- | mm/sparse.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/mm/sparse.c b/mm/sparse.c index b3c82ba30012..ac26eb0d73cd 100644 --- a/mm/sparse.c +++ b/mm/sparse.c | |||
@@ -24,6 +24,25 @@ struct mem_section mem_section[NR_SECTION_ROOTS][SECTIONS_PER_ROOT] | |||
24 | #endif | 24 | #endif |
25 | EXPORT_SYMBOL(mem_section); | 25 | EXPORT_SYMBOL(mem_section); |
26 | 26 | ||
27 | #ifdef NODE_NOT_IN_PAGE_FLAGS | ||
28 | /* | ||
29 | * If we did not store the node number in the page then we have to | ||
30 | * do a lookup in the section_to_node_table in order to find which | ||
31 | * node the page belongs to. | ||
32 | */ | ||
33 | #if MAX_NUMNODES <= 256 | ||
34 | static u8 section_to_node_table[NR_MEM_SECTIONS] __cacheline_aligned; | ||
35 | #else | ||
36 | static u16 section_to_node_table[NR_MEM_SECTIONS] __cacheline_aligned; | ||
37 | #endif | ||
38 | |||
39 | int page_to_nid(struct page *page) | ||
40 | { | ||
41 | return section_to_node_table[page_to_section(page)]; | ||
42 | } | ||
43 | EXPORT_SYMBOL(page_to_nid); | ||
44 | #endif | ||
45 | |||
27 | #ifdef CONFIG_SPARSEMEM_EXTREME | 46 | #ifdef CONFIG_SPARSEMEM_EXTREME |
28 | static struct mem_section *sparse_index_alloc(int nid) | 47 | static struct mem_section *sparse_index_alloc(int nid) |
29 | { | 48 | { |
@@ -49,6 +68,10 @@ static int sparse_index_init(unsigned long section_nr, int nid) | |||
49 | struct mem_section *section; | 68 | struct mem_section *section; |
50 | int ret = 0; | 69 | int ret = 0; |
51 | 70 | ||
71 | #ifdef NODE_NOT_IN_PAGE_FLAGS | ||
72 | section_to_node_table[section_nr] = nid; | ||
73 | #endif | ||
74 | |||
52 | if (mem_section[root]) | 75 | if (mem_section[root]) |
53 | return -EEXIST; | 76 | return -EEXIST; |
54 | 77 | ||