From bdf7a0bd8a26ccdd94aaf972d469976563a0c0d7 Mon Sep 17 00:00:00 2001 From: Jiri Slaby Date: Apr 20 2023 11:01:00 +0000 Subject: cgroup/cpuset: Wake up cpuset_attach_wq tasks in cpuset_cancel_attach() (bsc#1012628). --- diff --git a/patches.kernel.org/6.2.12-117-cgroup-cpuset-Wake-up-cpuset_attach_wq-tasks-i.patch b/patches.kernel.org/6.2.12-117-cgroup-cpuset-Wake-up-cpuset_attach_wq-tasks-i.patch new file mode 100644 index 0000000..5bbe2c4 --- /dev/null +++ b/patches.kernel.org/6.2.12-117-cgroup-cpuset-Wake-up-cpuset_attach_wq-tasks-i.patch @@ -0,0 +1,56 @@ +From: Waiman Long +Date: Tue, 11 Apr 2023 09:35:57 -0400 +Subject: [PATCH] cgroup/cpuset: Wake up cpuset_attach_wq tasks in + cpuset_cancel_attach() +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit +References: bsc#1012628 +Patch-mainline: 6.2.12 +Git-commit: ba9182a89626d5f83c2ee4594f55cb9c1e60f0e2 + +commit ba9182a89626d5f83c2ee4594f55cb9c1e60f0e2 upstream. + +After a successful cpuset_can_attach() call which increments the +attach_in_progress flag, either cpuset_cancel_attach() or cpuset_attach() +will be called later. In cpuset_attach(), tasks in cpuset_attach_wq, +if present, will be woken up at the end. That is not the case in +cpuset_cancel_attach(). So missed wakeup is possible if the attach +operation is somehow cancelled. Fix that by doing the wakeup in +cpuset_cancel_attach() as well. + +Fixes: e44193d39e8d ("cpuset: let hotplug propagation work wait for task attaching") +Signed-off-by: Waiman Long +Reviewed-by: Michal Koutný +Cc: stable@vger.kernel.org # v3.11+ +Signed-off-by: Tejun Heo +Signed-off-by: Greg Kroah-Hartman +Signed-off-by: Jiri Slaby +--- + kernel/cgroup/cpuset.c | 6 +++++- + 1 file changed, 5 insertions(+), 1 deletion(-) + +diff --git a/kernel/cgroup/cpuset.c b/kernel/cgroup/cpuset.c +index 56fb79a4..86cd79e8 100644 +--- a/kernel/cgroup/cpuset.c ++++ b/kernel/cgroup/cpuset.c +@@ -2502,11 +2502,15 @@ static int cpuset_can_attach(struct cgroup_taskset *tset) + static void cpuset_cancel_attach(struct cgroup_taskset *tset) + { + struct cgroup_subsys_state *css; ++ struct cpuset *cs; + + cgroup_taskset_first(tset, &css); ++ cs = css_cs(css); + + percpu_down_write(&cpuset_rwsem); +- css_cs(css)->attach_in_progress--; ++ cs->attach_in_progress--; ++ if (!cs->attach_in_progress) ++ wake_up(&cpuset_attach_wq); + percpu_up_write(&cpuset_rwsem); + } + +-- +2.35.3 + diff --git a/series.conf b/series.conf index c9e11ad..ab30977 100644 --- a/series.conf +++ b/series.conf @@ -2344,6 +2344,7 @@ patches.kernel.org/6.2.12-114-x86-PCI-Add-quirk-for-AMD-XHCI-controller-that.patch patches.kernel.org/6.2.12-115-cgroup-fix-display-of-forceidle-time-at-root.patch patches.kernel.org/6.2.12-116-cgroup-cpuset-Fix-partition-root-s-cpuset.cpus.patch + patches.kernel.org/6.2.12-117-cgroup-cpuset-Wake-up-cpuset_attach_wq-tasks-i.patch ######################################################## # Build fixes that apply to the vanilla kernel too.