Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp37733458rwd; Tue, 11 Jul 2023 19:42:01 -0700 (PDT) X-Google-Smtp-Source: APBJJlEt23hY1rj4LM0mTuHiZ2cbNviOzaexFAyJ3MTvXY9vnXQKwHIY0ger/pV6ZM2nVK8cQks3 X-Received: by 2002:a17:906:7313:b0:974:c32c:b485 with SMTP id di19-20020a170906731300b00974c32cb485mr20000333ejc.45.1689129721552; Tue, 11 Jul 2023 19:42:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689129721; cv=none; d=google.com; s=arc-20160816; b=iZ/8qPDISYudUuMAJDdjMy/M3zTnxSpey3k7wTEUXr1+3UwhaXFHJ1dNwUQrBFXNUx 0FaioSgpKfPDsYUlVd6ODcC4RQ0AFDiNBCv8PcqfPtZ2RIsnoia+cZ/vJKCy6CtyilHz G+e+YpitUdLiGU+IAQ5YVN5OwHQ1vVA7wGN4pKrNT4mej7WRL70FhApdHIjXK7CbKD2w f7oAKHErh4r0t8CZeBjePnE7HCW7jKE0zNdjioYaKrZeXeK92NNpgqhwDrsciHgZryCF M6qUFpAim1VwpZwUg7uDiJ8mEeVCuqeDRUF6c67TXZMUF0qMBn+TSV1fq2dMIBaL+S/H jvvA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject; bh=k4ESR/2MT6+gUKIrS3BouJ+IVxxevRR41cW5EDGvsbE=; fh=otPt14LWYfoNhK+wu4JbDL2ZWGggemHcWGYHI40D8u4=; b=ikNm31RUeR+HHvWQ+nP1qDBZjXkUZzeqQyxZOOKQkH5lq4Gyfm1zu2/PKgTs281hzK 3/Ose4XS924n0PWdXSbt6wFl+PbIZBNWyWv4iw+PC1/hbabtaUfjx91NhuaX3aR65o5H v3NbLXZCXJXQBa+W9YcOWU4is6zFBaxvmQrK6ny7WA7oym/iWYHThSfEhxaCYRgJJOQA cuzMdlDomRe2rq3TbL8wD8/Dy6h/ZF4sLE2zQAkEo22Q4XLb8x9MOrSTMLpUnjpNnfGa ORo3SqFcIIvy6VPve4sAOmzxYFVJrRuYurRuxHxJYLHlLgRoMgRBXupRArtbNph1f8nN nreg== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h14-20020a170906110e00b00974fb8ff39asi3712689eja.580.2023.07.11.19.41.37; Tue, 11 Jul 2023 19:42:01 -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; 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=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230381AbjGLB5B (ORCPT + 99 others); Tue, 11 Jul 2023 21:57:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33602 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229551AbjGLB5A (ORCPT ); Tue, 11 Jul 2023 21:57:00 -0400 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 33523171E; Tue, 11 Jul 2023 18:56:59 -0700 (PDT) Received: from canpemm500002.china.huawei.com (unknown [172.30.72.55]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4R116S2Y4CzVjZf; Wed, 12 Jul 2023 09:55:44 +0800 (CST) Received: from [10.174.151.185] (10.174.151.185) by canpemm500002.china.huawei.com (7.192.104.244) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.27; Wed, 12 Jul 2023 09:56:56 +0800 Subject: Re: [PATCH] cgroup/cpuset: update parent subparts cpumask while holding css refcnt To: =?UTF-8?Q?Michal_Koutn=c3=bd?= , Waiman Long CC: , , , , References: <20230701065049.1758266-1-linmiaohe@huawei.com> <74f1906e-fe58-c745-a851-b160374f7acf@redhat.com> <30b1f809-a11b-efe8-289c-04a801f20207@huawei.com> From: Miaohe Lin Message-ID: <7233195b-63bc-ff1a-3b14-6eca0db7cc25@huawei.com> Date: Wed, 12 Jul 2023 09:56:56 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.6.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="windows-1252" Content-Language: en-US Content-Transfer-Encoding: 8bit X-Originating-IP: [10.174.151.185] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To canpemm500002.china.huawei.com (7.192.104.244) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-4.3 required=5.0 tests=BAYES_00,NICE_REPLY_A, RCVD_IN_DNSWL_MED,RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham 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 On 2023/7/11 19:52, Michal Koutn? wrote: > On Tue, Jul 11, 2023 at 10:52:02AM +0800, Miaohe Lin wrote: >> commit 2bdfd2825c9662463371e6691b1a794e97fa36b4 >> Author: Waiman Long >> Date: Wed Feb 2 22:31:03 2022 -0500 >> >> cgroup/cpuset: Fix "suspicious RCU usage" lockdep warning > > Aha, thanks for the pointer. > > I've also found a paragraph in [1]: >> In addition, the -rt patchset turns spinlocks into a sleeping locks so >> that the corresponding critical sections can be preempted, which also >> means that these sleeplockified spinlocks (but not other sleeping >> locks!) may be acquire within -rt-Linux-kernel RCU read-side critical >> sections. > > That suggests (together with practical use) that dicussed spinlocks > should be fine in RCU read section. And the possible reason is deeper in > generate_sched_domains() that do kmalloc(..., GFP_KERNEL). update_parent_subparts_cpumask() would call update_flag() that do kmemdup(..., GFP_KERNEL)? > > Alas update_cpumask_hier() still calls generate_sched_domains(), OTOH, > update_parent_subparts_cpumask() doesn't seem so. It seems update_parent_subparts_cpumask() doesn't call generate_sched_domains(). > > The idea to not relieve rcu_read_lock() in update_cpumask() iteration > (instead of the technically unneeded refcnt bump) would have to be > verified with CONFIG_PROVE_RCU && CONFIG_LOCKDEP. WDYT? The idea to relieve rcu_read_lock() in update_cpumask() iteration was initially introduced via the below commit: commit d7c8142d5a5534c3c7de214e35a40a493a32b98e Author: Waiman Long Date: Thu Sep 1 16:57:43 2022 -0400 cgroup/cpuset: Make partition invalid if cpumask change violates exclusivity rule Currently, changes in "cpust.cpus" of a partition root is not allowed if it violates the sibling cpu exclusivity rule when the check is done in the validate_change() function. That is inconsistent with the other cpuset changes that are always allowed but may make a partition invalid. Update the cpuset code to allow cpumask change even if it violates the sibling cpu exclusivity rule, but invalidate the partition instead just like the other changes. However, other sibling partitions with conflicting cpumask will also be invalidated in order to not violating the exclusivity rule. This behavior is specific to this partition rule violation. Note that a previous commit has made sibling cpu exclusivity rule check the last check of validate_change(). So if -EINVAL is returned, we can be sure that sibling cpu exclusivity rule violation is the only rule that is broken. It would be really helpful if @Waiman can figure this out. Thanks both.