* linux-next: build failure after merge of the final tree (akpm tree related)
@ 2013-01-21 6:08 Stephen Rothwell
2013-01-21 7:17 ` Tang Chen
2013-01-21 7:25 ` [PATCH v2 1/1] page_alloc: Bootmem limit with movablecore_map Tang Chen
0 siblings, 2 replies; 3+ messages in thread
From: Stephen Rothwell @ 2013-01-21 6:08 UTC (permalink / raw)
To: Andrew Morton; +Cc: linux-next, linux-kernel, Tang Chen
[-- Attachment #1: Type: text/plain, Size: 812 bytes --]
Hi all,
After merging the final tree, today's linux-next build (arm defconfig)
failed like this:
mm/memblock.c: In function 'memblock_find_in_range_node':
mm/memblock.c:104:2: error: invalid use of undefined type 'struct movablecore_map'
mm/memblock.c:123:4: error: invalid use of undefined type 'struct movablecore_map'
mm/memblock.c:130:7: error: invalid use of undefined type 'struct movablecore_map'
mm/memblock.c:131:4: error: invalid use of undefined type 'struct movablecore_map'
Caused by commit "page_alloc: bootmem limit with movablecore_map" from
the akpm tree. The definition of struct movablecore_map is protected by
CONFIG_HAVE_MEMBLOCK_NODE_MAP but its use is not.
I have reverted that commit for today.
--
Cheers,
Stephen Rothwell sfr@canb.auug.org.au
[-- Attachment #2: Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: linux-next: build failure after merge of the final tree (akpm tree related)
2013-01-21 6:08 linux-next: build failure after merge of the final tree (akpm tree related) Stephen Rothwell
@ 2013-01-21 7:17 ` Tang Chen
2013-01-21 7:25 ` [PATCH v2 1/1] page_alloc: Bootmem limit with movablecore_map Tang Chen
1 sibling, 0 replies; 3+ messages in thread
From: Tang Chen @ 2013-01-21 7:17 UTC (permalink / raw)
To: Stephen Rothwell; +Cc: Andrew Morton, linux-next, linux-kernel
Hi Stephen,
On 01/21/2013 02:08 PM, Stephen Rothwell wrote:
> Hi all,
>
> After merging the final tree, today's linux-next build (arm defconfig)
> failed like this:
>
> mm/memblock.c: In function 'memblock_find_in_range_node':
> mm/memblock.c:104:2: error: invalid use of undefined type 'struct movablecore_map'
> mm/memblock.c:123:4: error: invalid use of undefined type 'struct movablecore_map'
> mm/memblock.c:130:7: error: invalid use of undefined type 'struct movablecore_map'
> mm/memblock.c:131:4: error: invalid use of undefined type 'struct movablecore_map'
>
> Caused by commit "page_alloc: bootmem limit with movablecore_map" from
> the akpm tree. The definition of struct movablecore_map is protected by
> CONFIG_HAVE_MEMBLOCK_NODE_MAP but its use is not.
>
> I have reverted that commit for today.
Thank you very much for reporting this. It was my mistake to miss this
definition.
I will post a new version of "page_alloc: bootmem limit with
movablecore_map" since
you have reverted it.
CONFIG_HAVE_MEMBLOCK_NODE_MAP is selected by x86=y, but I don't have any
non-x86 box.
So I didn't test it. Please tell me if you have any problem with it on
other platforms.
Thanks. :)
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH v2 1/1] page_alloc: Bootmem limit with movablecore_map
2013-01-21 6:08 linux-next: build failure after merge of the final tree (akpm tree related) Stephen Rothwell
2013-01-21 7:17 ` Tang Chen
@ 2013-01-21 7:25 ` Tang Chen
1 sibling, 0 replies; 3+ messages in thread
From: Tang Chen @ 2013-01-21 7:25 UTC (permalink / raw)
To: sfr, tangchen, akpm; +Cc: linux-next, linux-kernel
This patch make sure bootmem will not allocate memory from areas that
may be ZONE_MOVABLE. The map info is from movablecore_map boot option.
Signed-off-by: Tang Chen <tangchen@cn.fujitsu.com>
Reviewed-by: Wen Congyang <wency@cn.fujitsu.com>
Reviewed-by: Lai Jiangshan <laijs@cn.fujitsu.com>
Tested-by: Lin Feng <linfeng@cn.fujitsu.com>
---
include/linux/memblock.h | 2 +
mm/memblock.c | 50 ++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 52 insertions(+), 0 deletions(-)
diff --git a/include/linux/memblock.h b/include/linux/memblock.h
index d452ee1..ac52bbc 100644
--- a/include/linux/memblock.h
+++ b/include/linux/memblock.h
@@ -60,6 +60,8 @@ int memblock_reserve(phys_addr_t base, phys_addr_t size);
void memblock_trim_memory(phys_addr_t align);
#ifdef CONFIG_HAVE_MEMBLOCK_NODE_MAP
+extern struct movablecore_map movablecore_map;
+
void __next_mem_pfn_range(int *idx, int nid, unsigned long *out_start_pfn,
unsigned long *out_end_pfn, int *out_nid);
diff --git a/mm/memblock.c b/mm/memblock.c
index 88adc8a..0218231 100644
--- a/mm/memblock.c
+++ b/mm/memblock.c
@@ -92,9 +92,58 @@ static long __init_memblock memblock_overlaps_region(struct memblock_type *type,
*
* Find @size free area aligned to @align in the specified range and node.
*
+ * If we have CONFIG_HAVE_MEMBLOCK_NODE_MAP defined, we need to check if the
+ * memory we found if not in hotpluggable ranges.
+ *
* RETURNS:
* Found address on success, %0 on failure.
*/
+#ifdef CONFIG_HAVE_MEMBLOCK_NODE_MAP
+phys_addr_t __init_memblock memblock_find_in_range_node(phys_addr_t start,
+ phys_addr_t end, phys_addr_t size,
+ phys_addr_t align, int nid)
+{
+ phys_addr_t this_start, this_end, cand;
+ u64 i;
+ int curr = movablecore_map.nr_map - 1;
+
+ /* pump up @end */
+ if (end == MEMBLOCK_ALLOC_ACCESSIBLE)
+ end = memblock.current_limit;
+
+ /* avoid allocating the first page */
+ start = max_t(phys_addr_t, start, PAGE_SIZE);
+ end = max(start, end);
+
+ for_each_free_mem_range_reverse(i, nid, &this_start, &this_end, NULL) {
+ this_start = clamp(this_start, start, end);
+ this_end = clamp(this_end, start, end);
+
+restart:
+ if (this_end <= this_start || this_end < size)
+ continue;
+
+ for (; curr >= 0; curr--) {
+ if ((movablecore_map.map[curr].start_pfn << PAGE_SHIFT)
+ < this_end)
+ break;
+ }
+
+ cand = round_down(this_end - size, align);
+ if (curr >= 0 &&
+ cand < movablecore_map.map[curr].end_pfn << PAGE_SHIFT) {
+ this_end = movablecore_map.map[curr].start_pfn
+ << PAGE_SHIFT;
+ goto restart;
+ }
+
+ if (cand >= this_start)
+ return cand;
+ }
+
+ return 0;
+}
+#else /* CONFIG_HAVE_MEMBLOCK_NODE_MAP */
phys_addr_t __init_memblock memblock_find_in_range_node(phys_addr_t start,
phys_addr_t end, phys_addr_t size,
phys_addr_t align, int nid)
@@ -123,6 +172,7 @@ phys_addr_t __init_memblock memblock_find_in_range_node(phys_addr_t start,
}
return 0;
}
+#endif /* CONFIG_HAVE_MEMBLOCK_NODE_MAP */
/**
* memblock_find_in_range - find free area in given range
--
1.7.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2013-01-21 7:25 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-01-21 6:08 linux-next: build failure after merge of the final tree (akpm tree related) Stephen Rothwell
2013-01-21 7:17 ` Tang Chen
2013-01-21 7:25 ` [PATCH v2 1/1] page_alloc: Bootmem limit with movablecore_map Tang Chen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).