In pcpu_setup_first_chunk() pcpu_reserved_chunk is assigned to point to static chunk. While pcpu_first_chunk is got from below code: pcpu_first_chunk = dchunk ?: schunk; Then it could point to static chunk too if dynamic chunk doesn't exist. So in this patch adding a check in percpu_init_late() to see if pcpu_first_chunk is equal to pcpu_reserved_chunk. Only if they are not equal we add pcpu_reserved_chunk to the target array. Signed-off-by: Baoquan He <bhe@xxxxxxxxxx> --- mm/percpu.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/mm/percpu.c b/mm/percpu.c index a63b4d8..f7e02c0 100644 --- a/mm/percpu.c +++ b/mm/percpu.c @@ -2260,11 +2260,18 @@ void __init setup_per_cpu_areas(void) void __init percpu_init_late(void) { struct pcpu_chunk *target_chunks[] = - { pcpu_first_chunk, pcpu_reserved_chunk, NULL }; + { pcpu_first_chunk, NULL, NULL }; struct pcpu_chunk *chunk; unsigned long flags; int i; + /* + * pcpu_first_chunk could be the same as pcpu_reserved_chunk, add it to the + * target array only if pcpu_first_chunk is not equal to pcpu_reserved_chunk. + */ + if (pcpu_first_chunk != pcpu_reserved_chunk) + target_chunks[1] = pcpu_reserved_chunk; + for (i = 0; (chunk = target_chunks[i]); i++) { int *map; const size_t size = PERCPU_DYNAMIC_EARLY_SLOTS * sizeof(map[0]); -- 1.9.3 -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@xxxxxxxxx. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"dont@xxxxxxxxx"> email@xxxxxxxxx </a>