• Nathan Lynch's avatar
    powerpc/smp: poll cpu_callin_map more aggressively in __cpu_up() · b37ac189
    Nathan Lynch authored
    At boot time, it is not necessary to delay between polls of
    cpu_callin_map when waiting for a kicked CPU to come up. Remove the
    delay intervals, but preserve the overall deadline (five seconds).
    
    At run time, the first poll result is usually negative and we incur a
    sleeping wait. If we spin on the callin word for a short time first,
    we can reduce __cpu_up() from dozens of milliseconds to under 1ms in
    the common case on a P9 LPAR:
    
    $ ppc64_cpu --smt=off
    $ bpftrace -e 'kprobe:__cpu_up {
                     @start[tid] = nsecs;
                   }
                   kretprobe:__cpu_up /@start[tid]/ {
                     @us = hist((nsecs - @start[tid]) / 1000);
                     delete(@start[tid]);
                   }' -c 'ppc64_cpu --smt=on'
    
    Before:
    
    @us:
    [16K, 32K)        85 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@|
    [32K, 64K)        13 |@@@@@@@                                             |
    
    After:
    
    @us:
    [128, 256)        95 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@|
    [256, 512)         3 |@                                                   |
    Signed-off-by: default avatarNathan Lynch <nathanl@linux.ibm.com>
    Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
    Link: https://lore.kernel.org/r/20220926220250.157022-1-nathanl@linux.ibm.com
    b37ac189
smp.c 42.9 KB