Skip to content
  • Zwane Mwaikambo's avatar
    [PATCH] i386 boottime for_each_cpu broken · 4ad8d383
    Zwane Mwaikambo authored
    for_each_cpu walks through all processors in cpu_possible_map, which is
    defined as cpu_callout_map on i386 and isn't initialised until all
    processors have been booted. This breaks things which do for_each_cpu
    iterations early during boot. So, define cpu_possible_map as a bitmap with
    NR_CPUS bits populated. This was triggered by a patch i'm working on which
    does alloc_percpu before bringing up secondary processors.
    From: Alexander Nyberg <>
    The SMP version of __alloc_percpu checks the cpu_possible_map before
    allocating memory for a certain cpu.  With the above patches the BSP cpuid
    is never set in cpu_possible_map which breaks CONFIG_SMP on uniprocessor
    machines (as soon as someone tries to dereference something allocated via
    __alloc_percpu, which in fact is never allocated since the cpu is not set
    in cpu_possible_map).
    Signed-off-by: default avatarZwane Mwaikambo <>
    Signed-off-by: default avatarAlexander Nyberg <>
    Signed-off-by: default avatarAndrew Morton <>
    Signed-off-by: default avatarLinus Torvalds <>