From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from dggsgout12.his.huawei.com (dggsgout12.his.huawei.com [45.249.212.56]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 787855695; Wed, 17 Dec 2025 00:53:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.249.212.56 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765932824; cv=none; b=C3BbjyrIHr7IpWJmHsxlqmQ8IXjQOwwi9G+nLDDTBxHwDovIwrRt4irG4vbOSJRlnf0sX9YAGfCU7uGkqY4W0+OMjvPzPZQz6YBe+SV60zG5bobVRp2skJU45HFVv2ViZ8M0NILLH87TIQyVgTxSFvIP5CJXIa+ddcHudWcXaFo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765932824; c=relaxed/simple; bh=vwEQS11GqPr8ym2PanLmQM04B2ymccdXNCZZeBnK+4g=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=QHcWB5y/m3tmGDXYmW5cX6hybn9oaEtr/Y5RqYfL5DQ5p+dKwqru+yP2CoZBtuZBruYgEtOiytOirhNssuxEs5sG3wIjZSwWvqpfFKEvuY5G7C2HkUWn867hR8U7IzlZlBpKCgdQSEPkuu8LX28Dm66q0bwmm9d7q2BT4A5nHVc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=huaweicloud.com; spf=pass smtp.mailfrom=huaweicloud.com; arc=none smtp.client-ip=45.249.212.56 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=huaweicloud.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huaweicloud.com Received: from mail.maildlp.com (unknown [172.19.163.170]) by dggsgout12.his.huawei.com (SkyGuard) with ESMTPS id 4dWFfL40jLzKHLym; Wed, 17 Dec 2025 08:53:30 +0800 (CST) Received: from mail02.huawei.com (unknown [10.116.40.252]) by mail.maildlp.com (Postfix) with ESMTP id E37A14056C; Wed, 17 Dec 2025 08:53:38 +0800 (CST) Received: from [10.67.111.176] (unknown [10.67.111.176]) by APP3 (Coremail) with SMTP id _Ch0CgCn9BIR_0FpiAvGAQ--.28390S2; Wed, 17 Dec 2025 08:53:38 +0800 (CST) Message-ID: <3785c9ca-5bdb-4ff2-9c8f-a3515ba58538@huaweicloud.com> Date: Wed, 17 Dec 2025 08:53:37 +0800 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH -next] cpuset: add cpuset1_online_css helper for v1-specific operations To: Waiman Long , =?UTF-8?Q?Michal_Koutn=C3=BD?= Cc: tj@kernel.org, hannes@cmpxchg.org, cgroups@vger.kernel.org, linux-kernel@vger.kernel.org, lujialin4@huawei.com References: <20251216012845.2437419-1-chenridong@huaweicloud.com> <5a35692f-2800-4fd4-9c23-97d0284293df@redhat.com> Content-Language: en-US From: Chen Ridong In-Reply-To: <5a35692f-2800-4fd4-9c23-97d0284293df@redhat.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-CM-TRANSID:_Ch0CgCn9BIR_0FpiAvGAQ--.28390S2 X-Coremail-Antispam: 1UD129KBjvJXoW7ZrW7Cw4UWF4xWFy3Xw45Awb_yoW8CrWkpF WDKa4UtFyktFZrCwn7Zw13Xr4Yqan5tF45JFn5CryFyrsxJ3ZF9r4j9Fs09FyUtr1xurW0 yrW7Krs3ua4qyrJanT9S1TB71UUUUU7qnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDU0xBIdaVrnRJUUUylb4IE77IF4wAFF20E14v26r4j6ryUM7CY07I20VC2zVCF04k2 6cxKx2IYs7xG6rWj6s0DM7CIcVAFz4kK6r1j6r18M28lY4IEw2IIxxk0rwA2F7IY1VAKz4 vEj48ve4kI8wA2z4x0Y4vE2Ix0cI8IcVAFwI0_Ar0_tr1l84ACjcxK6xIIjxv20xvEc7Cj xVAFwI0_Cr0_Gr1UM28EF7xvwVC2z280aVAFwI0_GcCE3s1l84ACjcxK6I8E87Iv6xkF7I 0E14v26rxl6s0DM2AIxVAIcxkEcVAq07x20xvEncxIr21l5I8CrVACY4xI64kE6c02F40E x7xfMcIj6xIIjxv20xvE14v26r106r15McIj6I8E87Iv67AKxVWUJVW8JwAm72CE4IkC6x 0Yz7v_Jr0_Gr1lF7xvr2IY64vIr41lc7CjxVAaw2AFwI0_JF0_Jw1l42xK82IYc2Ij64vI r41l4I8I3I0E4IkC6x0Yz7v_Jr0_Gr1lx2IqxVAqx4xG67AKxVWUJVWUGwC20s026x8Gjc xK67AKxVWUGVWUWwC2zVAF1VAY17CE14v26r126r1DMIIYrxkI7VAKI48JMIIF0xvE2Ix0 cI8IcVAFwI0_Jr0_JF4lIxAIcVC0I7IYx2IY6xkF7I0E14v26r4j6F4UMIIF0xvE42xK8V AvwI8IcIk0rVWUJVWUCwCI42IY6I8E87Iv67AKxVWUJVW8JwCI42IY6I8E87Iv6xkF7I0E 14v26r4j6r4UJbIYCTnIWIevJa73UjIFyTuYvjxUotCzDUUUU X-CM-SenderInfo: hfkh02xlgr0w46kxt4xhlfz01xgou0bp/ On 2025/12/16 22:58, Waiman Long wrote: > On 12/16/25 9:03 AM, Michal Koutný wrote: >> On Tue, Dec 16, 2025 at 08:13:53PM +0800, Chen Ridong wrote: >>> Regarding the lock assertions: cpuset_mutex is defined in cpuset.c and is not visible in >>> cpuset-v1.c. Given that cpuset v1 is deprecated, would you prefer that we add a helper to assert >>> cpuset_mutex is locked? Is that worth? >> It could be un-static'd and defined in cpuset-internal.h. (Hopefully, we >> should not end up with random callers of the helper but it's IMO worth >> it for docs and greater safety.) > I would suggest defining a "assert_cpuset_lock_held(void)" helper function and put the declaration > in include/linux/cpuset.h together with cpuset_lock/unlock() to complete the full set. This will > allow other kernel subsystems to acquire the cpuset_mutex and assert that the mutex was held. Considering potential use by other subsystems, this is worthwhile. I will add the helper. >> >>> Should we guard with !cpuset_v2() or !is_in_v2mode()? >>> >>> In cgroup v1, if the cpuset is operating in v2 mode, are these flags still valid? >> I have no experience with this transitional option so that made me look >> at the docs and there we specify it only affects behaviors of CPU masks, >> not the extra flags. So I wanted to suggest !cpuset_v2(), correct? > > The "cpuset_v2_mode" mount flag is used for making the behavior of cpuset.{cpus,mems}.effective in > v1 behave like in v2. It has no effect on other v1 specific control files. So cpuset1_online_css() > should only be called if "!cpuset_v2()". > If cpuset1_online_css() is only called under the condition !cpuset_v2(), a compile-time option might suffice? When CONFIG_CPUSETS_V1=n, cpuset1_online_css could be defined as an empty inline function. -- Best regards, Ridong