On Mon, Feb 12, 2018 at 02:58:57PM +0000, Mel Gorman wrote:
> diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
> index 28c8d9c91955..50442697b455 100644
> --- a/kernel/sched/fair.c
> +++ b/kernel/sched/fair.c
> @@ -5710,8 +5710,14 @@ wake_affine_idle(int this_cpu, int prev_cpu, int sync)
>       if (idle_cpu(this_cpu) && cpus_share_cache(this_cpu, prev_cpu))
>               return idle_cpu(prev_cpu) ? prev_cpu : this_cpu;
>  
> -     if (sync && cpu_rq(this_cpu)->nr_running == 1)
> +     if (sync && cpu_rq(this_cpu)->nr_running == 1) {
> +             /* Avoid tasks exiting pulling parents to new nodes */
> +             if ((current->flags & PF_EXITING) &&
> +                 !cpus_share_cache(this_cpu, prev_cpu))
> +                     return prev_cpu;
> +

Cute, but should we not kill @sync right at the source in this case?

Something a little like this?

diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index 5eb3ffc9be84..568ea4ce5b36 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -6342,7 +6342,7 @@ select_task_rq_fair(struct task_struct *p, int prev_cpu, 
int sd_flag, int wake_f
        int cpu = smp_processor_id();
        int new_cpu = prev_cpu;
        int want_affine = 0;
-       int sync = wake_flags & WF_SYNC;
+       int sync = (wake_flags & WF_SYNC) && !(current->flags & PF_EXITING);
 
        if (sd_flag & SD_BALANCE_WAKE) {
                record_wakee(p);

Reply via email to