Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp2200651rwl; Thu, 6 Apr 2023 07:10:41 -0700 (PDT) X-Google-Smtp-Source: AKy350bQTFB4CvH8yasJlInTzu5xfsDL9D5+njHxWANnF+OVmPeANHvt1acYL78EaMMkr/zRzdnJ X-Received: by 2002:a17:906:c30e:b0:93b:68a8:a0e0 with SMTP id s14-20020a170906c30e00b0093b68a8a0e0mr6778179ejz.16.1680790241009; Thu, 06 Apr 2023 07:10:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680790240; cv=none; d=google.com; s=arc-20160816; b=U+iTbRM4t2KP53no6hSXqPPzDrT2U21WOojHo80H/1SzXKlTft7F5X93D9Z6RXV6f3 bxZSd5RPywFlbD9Hn9Eg2kfflFDTfEY6VnA3g81Gmms98APJFZYL7wR+uHXaeuWQt/wh ZqYdw5fQwaqSXqfcHKhVNL994i9daquco+Pi4okSfHWQTsGOWEjDVXjFQGgcINZ7P9MM WTr3iZ1tc01+FLR+QcxaIYrdTQRzcDrwgurq+f4gZvnSBRPe2JX9znU6JSj/5VwJd91q 76L/54Ai/zix2Wk2lkJtXcUp38yITF3JHTe9smaQlRr89NGbh9fXMoptqQZI60uuYpmX mfHA== 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=8knbqgpwDwW2izpddcqO89y+h297sf846uyalSPG3Do=; b=pgFKr6txcAe2tH38KNVqU7vOOkETWZ1OxgxB1PjDynehCwlbmyFowcoUrk15Cd2CQD xjCLvKd7cK1JNiSllDU4guVHDcrJuRtHWNGKrLrhmoMfaDY0n4+TgRaA7A+gsp0ri8GD 308s/QUuh6z3QntBLAQk+tSPDtFPpr4XVSKqGQd9JYXG+AMpIBvAdOfUQcT0eePJKX3T diXyZD/2wIwJlKN8+WyZHDN8uH7Jtk8dGDF8lMfhtuqLV8OMECv3rbW3fe3a+cpQS1S7 vPSg4eIzUCZCqrC0poXb4J4OwPENySDIRleqDGlLTcD6ZR70EIxqLlXn8/BOPX75i/Yv xzyw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=VXvA9KNv; 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 q17-20020a170906941100b00939f6198089si1282984ejx.859.2023.04.06.07.10.00; Thu, 06 Apr 2023 07:10:40 -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=VXvA9KNv; 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 S237546AbjDFOF4 (ORCPT + 99 others); Thu, 6 Apr 2023 10:05:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45570 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238977AbjDFOFu (ORCPT ); Thu, 6 Apr 2023 10:05:50 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A91477ED5 for ; Thu, 6 Apr 2023 07:04:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1680789865; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=8knbqgpwDwW2izpddcqO89y+h297sf846uyalSPG3Do=; b=VXvA9KNvRK6Xs4znMAU0NEYWkHkHYZtm4zX1YiGN/aFnc1psXDqqvRLcFBXGdYB02fZDMz 0RW1iF01IQVu6cbPy8MwH9ppn+ndV97GOdIKHioRuROJLCtPNFvGIMTA4zq03TfgIU1Hs/ BqeQ652gsQkglrfgWIJzz0wcfOWBaII= 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-615-HQZRPLI8NEad4zdpzCF9rw-1; Thu, 06 Apr 2023 10:04:19 -0400 X-MC-Unique: HQZRPLI8NEad4zdpzCF9rw-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id B0D8F855304; Thu, 6 Apr 2023 14:04:18 +0000 (UTC) Received: from llong.com (unknown [10.22.9.26]) by smtp.corp.redhat.com (Postfix) with ESMTP id 40B0340C6EC4; Thu, 6 Apr 2023 14:04:18 +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 v3 1/4] cgroup/cpuset: Wake up cpuset_attach_wq tasks in cpuset_cancel_attach() Date: Thu, 6 Apr 2023 10:04:01 -0400 Message-Id: <20230406140404.2718574-2-longman@redhat.com> In-Reply-To: <20230406140404.2718574-1-longman@redhat.com> References: <20230406140404.2718574-1-longman@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.1 on 10.11.54.2 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 Reviewed-by: Michal Koutný --- 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