Patch "sched: Collate affine_move_task() stoppers" has been added to the 5.11-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    sched: Collate affine_move_task() stoppers

to the 5.11-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     sched-collate-affine_move_task-stoppers.patch
and it can be found in the queue-5.11 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.


>From 58b1a45086b5f80f2b2842aa7ed0da51a64a302b Mon Sep 17 00:00:00 2001
From: Peter Zijlstra <peterz@xxxxxxxxxxxxx>
Date: Wed, 24 Feb 2021 11:15:23 +0100
Subject: sched: Collate affine_move_task() stoppers

From: Peter Zijlstra <peterz@xxxxxxxxxxxxx>

commit 58b1a45086b5f80f2b2842aa7ed0da51a64a302b upstream.

The SCA_MIGRATE_ENABLE and task_running() cases are almost identical,
collapse them to avoid further duplication.

Fixes: 6d337eab041d ("sched: Fix migrate_disable() vs set_cpus_allowed_ptr()")
Cc: stable@xxxxxxxxxx
Signed-off-by: Peter Zijlstra (Intel) <peterz@xxxxxxxxxxxxx>
Signed-off-by: Ingo Molnar <mingo@xxxxxxxxxx>
Reviewed-by: Valentin Schneider <valentin.schneider@xxxxxxx>
Link: https://lkml.kernel.org/r/20210224131355.500108964@xxxxxxxxxxxxx
Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
---
 kernel/sched/core.c |   23 ++++++++---------------
 1 file changed, 8 insertions(+), 15 deletions(-)

--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -2279,30 +2279,23 @@ static int affine_move_task(struct rq *r
 		return -EINVAL;
 	}
 
-	if (flags & SCA_MIGRATE_ENABLE) {
-
-		refcount_inc(&pending->refs); /* pending->{arg,stop_work} */
-		p->migration_flags &= ~MDF_PUSH;
-		task_rq_unlock(rq, p, rf);
-
-		stop_one_cpu_nowait(cpu_of(rq), migration_cpu_stop,
-				    &pending->arg, &pending->stop_work);
-
-		return 0;
-	}
-
 	if (task_running(rq, p) || p->state == TASK_WAKING) {
 		/*
-		 * Lessen races (and headaches) by delegating
-		 * is_migration_disabled(p) checks to the stopper, which will
-		 * run on the same CPU as said p.
+		 * MIGRATE_ENABLE gets here because 'p == current', but for
+		 * anything else we cannot do is_migration_disabled(), punt
+		 * and have the stopper function handle it all race-free.
 		 */
+
 		refcount_inc(&pending->refs); /* pending->{arg,stop_work} */
+		if (flags & SCA_MIGRATE_ENABLE)
+			p->migration_flags &= ~MDF_PUSH;
 		task_rq_unlock(rq, p, rf);
 
 		stop_one_cpu_nowait(cpu_of(rq), migration_cpu_stop,
 				    &pending->arg, &pending->stop_work);
 
+		if (flags & SCA_MIGRATE_ENABLE)
+			return 0;
 	} else {
 
 		if (!is_migration_disabled(p)) {


Patches currently in stable-queue which might be from peterz@xxxxxxxxxxxxx are

queue-5.11/powerpc-perf-fix-handling-of-privilege-level-checks-in-perf-interrupt-context.patch
queue-5.11/sched-fix-migration_cpu_stop-requeueing.patch
queue-5.11/sched-simplify-set_affinity_pending-refcounts.patch
queue-5.11/perf-traceevent-ensure-read-cmdlines-are-null-terminated.patch
queue-5.11/perf-core-flush-pmu-internal-buffers-for-per-cpu-eve.patch
queue-5.11/sched-simplify-migration_cpu_stop.patch
queue-5.11/sched-membarrier-fix-missing-local-execution-of-ipi_sync_rq_state.patch
queue-5.11/x86-unwind-orc-disable-kasan-checking-in-the-orc-unwinder-part-2.patch
queue-5.11/arm64-perf-fix-64-bit-event-counter-read-truncation.patch
queue-5.11/sched-collate-affine_move_task-stoppers.patch
queue-5.11/sched-fix-affine_move_task-self-concurrency.patch
queue-5.11/stop_machine-mark-helpers-__always_inline.patch
queue-5.11/seqlock-lockdep-fix-seqcount_latch_init.patch
queue-5.11/sched-optimize-migration_cpu_stop.patch
queue-5.11/perf-build-fix-ccache-usage-in-cc-when-generating-arch-errno-table.patch
queue-5.11/mm-userfaultfd-fix-memory-corruption-due-to-writeprotect.patch
queue-5.11/perf-x86-intel-set-perf_attach_sched_cb-for-large-pe.patch



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux