Skip to contentSkip to conversation

FAILED: patch "[PATCH] cgroup/cpuset: Wake up cpuset_attach_wq tasks in" failed to apply to 4.14-stable tree

PATCH [email protected] 1 participant 1 message Apr 17, 2023

Subsystems (3)
lore
Share & tools
lore

[email protected]

author maintainer
#0 lore raw

The patch below does not apply to the 4.14-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.

To reproduce the conflict and resubmit, you may use the following commands:

git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-4.14.y
git checkout FETCH_HEAD
git cherry-pick -x ba9182a89626d5f83c2ee4594f55cb9c1e60f0e2
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '2023041704-banister-dreamt-9dfd@gregkh' --subject-prefix 'PATCH 4.14.y' HEAD^..

Possible dependencies:

ba9182a89626 ("cgroup/cpuset: Wake up cpuset_attach_wq tasks in cpuset_cancel_attach()") 1243dc518c9d ("cgroup/cpuset: Convert cpuset_mutex to percpu_rwsem")
f9a25f776d78 ("cpusets: Rebuild root domain deadline accounting information") 933a90bf4f35 ("Merge branch 'work.mount0' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs")

thanks,

greg k-h

------------------ original commit in Linus's tree ------------------

From ba9182a89626d5f83c2ee4594f55cb9c1e60f0e2 Mon Sep 17 00:00:00 2001
From: Waiman Long <[email protected]>
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

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")
Cc [email protected] # v3.11+
kernel/cgroup/cpuset.c +5 -1
index f310915d1257..ff7eb8e2efdc 100644
@@ -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);
 }