• Eric Dumazet's avatar
    rcu-tasks: Handle sparse cpu_possible_mask · 07d95c34
    Eric Dumazet authored
    If the rcupdate.rcu_task_enqueue_lim kernel boot parameter is set to
    something greater than 1 and less than nr_cpu_ids, the code attempts to
    use a subset of the CPU's RCU Tasks callback lists.  This works, but only
    if the cpu_possible_mask is contiguous.  If there are "holes" in this
    mask, the callback-enqueue code might attempt to access a non-existent
    per-CPU ->rtcpu variable for a non-existent CPU.  For example, if only
    CPUs 0, 4, 8, 12, 16 and so on are in cpu_possible_mask, specifying
    rcupdate.rcu_task_enqueue_lim=4 would cause the code to attempt to
    use callback queues for non-existent CPUs 1, 2, and 3.  Because such
    systems have existed in the past and might still exist, the code needs
    to gracefully handle this situation.
    
    This commit therefore checks to see whether the desired CPU is present
    in cpu_possible_mask, and, if not, searches for the next CPU.  This means
    that the systems administrator of a system with a sparse cpu_possible_mask
    will need to account for this sparsity when specifying the value of
    the rcupdate.rcu_task_enqueue_lim kernel boot parameter.  For example,
    setting this parameter to the value 4 will use only CPUs 0 and 4, which
    CPU 4 getting three times the callback load of CPU 0.
    
    This commit assumes that bit (nr_cpu_ids - 1) is always set in
    cpu_possible_mask.
    
    Link: https://lore.kernel.org/lkml/CANn89iKaNEwyNZ=L_PQnkH0LP_XjLYrr_dpyRKNNoDJaWKdrmg@mail.gmail.com/
    
    Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
    Signed-off-by: default avatarPaul E. McKenney <paulmck@kernel.org>
    07d95c34
tasks.h 60 KB