lkml.org 
[lkml]   [2020]   [Jun]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    Date
    From
    Subject[PATCH 1/6] sched: Fix ttwu_queue_cond()
    Where the condition:

    !cpus_share_cache(smp_processor_id(), cpu)

    already implies 'cpu != smp_processor_id()', because a CPU always
    shares cache with itself, the secondary condition added in commit:

    2ebb17717550 ("sched/core: Offload wakee task activation if it the wakee is descheduling")

    voids that implication, resulting in attempting to do local wake-ups
    through the queue mechanism.

    Fixes: 2ebb17717550 ("sched/core: Offload wakee task activation if it the wakee is descheduling")
    Reported-by: Paul E. McKenney <paulmck@kernel.org>
    Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
    Tested-by: Paul E. McKenney <paulmck@kernel.org>
    ---
    kernel/sched/core.c | 13 ++++++++++++-
    1 file changed, 12 insertions(+), 1 deletion(-)

    --- a/kernel/sched/core.c
    +++ b/kernel/sched/core.c
    @@ -2356,11 +2356,22 @@ bool cpus_share_cache(int this_cpu, int

    static inline bool ttwu_queue_cond(int cpu, int wake_flags)
    {
    + int this_cpu = smp_processor_id();
    +
    + /*
    + * Only ever queue for remote wakeups. The on_cpu case can only ever
    + * happen remotely, and for the normal case it makes no sense to
    + * involve IPIs here, and would be broken, as many architectures cannot
    + * trivially IPI self in any case.
    + */
    + if (cpu == this_cpu)
    + return false;
    +
    /*
    * If the CPU does not share cache, then queue the task on the
    * remote rqs wakelist to avoid accessing remote data.
    */
    - if (!cpus_share_cache(smp_processor_id(), cpu))
    + if (!cpus_share_cache(this_cpu, cpu))
    return true;

    /*

    \
     
     \ /
      Last update: 2020-06-15 15:18    [W:2.263 / U:0.092 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site