Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp6287577rwl; Tue, 4 Apr 2023 10:14:29 -0700 (PDT) X-Google-Smtp-Source: AKy350YTTqMmIyeVpL6krWXzafEc3oSYG6jI9QTKoKQ6+0EuzzzmF1/CW+IGk0iohoHWac5TQ4k8 X-Received: by 2002:a17:906:5a83:b0:931:c99c:480 with SMTP id l3-20020a1709065a8300b00931c99c0480mr269135ejq.69.1680628469544; Tue, 04 Apr 2023 10:14:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680628469; cv=none; d=google.com; s=arc-20160816; b=Kb6CsJ4gyjOCYKqohrQ7CcPFY0lgr3MZmCFKAOK8GbA3Fk/AuciPrN0OPMypAHlqWm 92xDOpVBb9eDcnMxTVVfByDuQp/KY6uunoBXuLEdbY4EB6IQLNFHvKidTB+a8lEhCK1L w0DU+xZV+DSzQOSH+yXfO1kAdk1CpNPDHLmdU0asLYWL4hqldmHsOExilZybaYlxBnZD klwJbTKD4SSl5e5kFpVXX2uu8RLklAfbNWMNW7Be/GxEEdTWns4hhbqlvWeCOq25GfAd Il6FWT+mi6jlv45YNCmn6Hf3TY4huOopNSng1bW0Pd34mkVWhWQ1ygPc19IvWUYsFOK5 fJmg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=k8j2HkuWn0j0Z7PhnLLGKz76k+59+HcmFbNhPcenFyw=; b=ecp0ayV07PWY3cewIxp2h+WnEWOoN4osj3Oc69z2FjPeHfkjFV1uZ6QbK76MovWp5Z pg+vpw/h1+DPWOJOTfJHlZ7s0KpKkNKO/Q01Aa7f3z/2/trfW2ESaVGg9G/jTdu5cc2O cYHONgnKV+fcO7iYB5uk2BCNzPLIW8apNPaEV9IslCpVSRoPYKbHjTn5kU+GUCTbIh4a 0bsFcrRro7nD5QyAux4zUeqd9S6WEiKlW4Ov96pK65BtGYypfCspMSITkYW3N9BGlW25 xdH+g/5vYgVsNGRcC8IV/cQMMMmV5sNVFHWA5bYFdF1BP5iz/S4twt9uOFfMbGym4oTN d+jA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=f1dxsfC3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id lo1-20020a170906fa0100b00933314f56fdsi6198853ejb.737.2023.04.04.10.14.04; Tue, 04 Apr 2023 10:14:29 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=f1dxsfC3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235495AbjDDRHG (ORCPT + 99 others); Tue, 4 Apr 2023 13:07:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52764 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233879AbjDDRHD (ORCPT ); Tue, 4 Apr 2023 13:07:03 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2977E12D for ; Tue, 4 Apr 2023 10:06:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1680627981; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=k8j2HkuWn0j0Z7PhnLLGKz76k+59+HcmFbNhPcenFyw=; b=f1dxsfC3FWlFy3tKVjyILA69Aw+t08YMLykOxKfVMdrowLCNXwIgKT3wuUlm3JPmdpkZa7 BK9hZL9ZfjYZ5VbEq9VyM8cfqWE7FK2QKYku714JyhdNtWS5vzKA+iDyaZA7jDy5sKIwbb rSGKCTjyPb/nq7mc7M//jFzrFgL9+oI= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-654-Xrcny9mLNxWYG8y8aIzIeQ-1; Tue, 04 Apr 2023 13:06:17 -0400 X-MC-Unique: Xrcny9mLNxWYG8y8aIzIeQ-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 16BAF185A790; Tue, 4 Apr 2023 17:06:17 +0000 (UTC) Received: from llong.com (unknown [10.22.32.153]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9ABDFFD6E; Tue, 4 Apr 2023 17:06:16 +0000 (UTC) From: Waiman Long To: Tejun Heo , Zefan Li , Johannes Weiner , Christian Brauner Cc: cgroups@vger.kernel.org, linux-kernel@vger.kernel.org, Juri Lelli , Dietmar Eggemann , =?UTF-8?q?Michal=20Koutn=C3=BD?= , gscrivan@redhat.com, Waiman Long Subject: [PATCH v2 1/4] cgroup/cpuset: Wake up cpuset_attach_wq tasks in cpuset_cancel_attach() Date: Tue, 4 Apr 2023 13:05:43 -0400 Message-Id: <20230404170546.2585050-2-longman@redhat.com> In-Reply-To: <20230404170546.2585050-1-longman@redhat.com> References: <20230404170546.2585050-1-longman@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.1 on 10.11.54.5 X-Spam-Status: No, score=-0.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- 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 bc4dcfd7bee5..066689a7dcc3 100644 --- a/kernel/cgroup/cpuset.c +++ b/kernel/cgroup/cpuset.c @@ -2507,11 +2507,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.31.1