From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (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 E4B14242D9B for ; Wed, 12 Nov 2025 04:09:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1762920575; cv=none; b=pnIvyF/R/JYLTy9/U2y9KLidO/gP5Ia1ahGS85GHXiIJ+HhpFpU+zsC1begKAaW9YV4SQFS1qhGCEwrEq9GDhPGu3/umrnplgWtNhXOw0FRzDTQ5IapfE9h6skZdYlLx0uR8j8foYpxrHd0f9md/Zs25HdF24lCeyOEzwqYoUPI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1762920575; c=relaxed/simple; bh=9PW+A3JHWzURTlDXLHDmB0OKXZRnM2OGKf4qPL38i74=; h=From:Message-ID:Date:MIME-Version:Subject:To:Cc:References: In-Reply-To:Content-Type; b=pzh/GO6zq5cE+TfTBe8Ze5jFLZmfj7bJ2nfXtRjRrmzZchXv3pdRWpjFxRS10vV3eoz0Ky3+kBr+2Ma3oa+kg9l+Jkjm+C+7rO+XtMUHx9XkmFoitjX6vkJNQq08ypGrjvNcbjVaG5/BAy75VIHkrTfs06ostGA+AppukZSQcd4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=RqGPCslN; dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com header.b=ekFg/j6a; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="RqGPCslN"; dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com header.b="ekFg/j6a" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1762920572; 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=jBULf+ZIkA9FqHKiIs1320k4feJF2I1rgP/b6d4F0Mk=; b=RqGPCslNWScVnn2Ck8198zp8k3QFwJYzUEuVbqRCtQLYv2/sfM0iFmajjpAhRgAuSCvhp9 Cbg7FJRC6OJXEFBWv/PmqM9xc3NYFCRGjAEZ5gvR6fZbgty7GwRv4P15aqJNps20rNWsfT bXN54Zvd4ak6z5h70UF33wK13wLegW4= Received: from mail-qt1-f200.google.com (mail-qt1-f200.google.com [209.85.160.200]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-636-sgmsAo9yN2ODb1fns5m6sQ-1; Tue, 11 Nov 2025 23:09:31 -0500 X-MC-Unique: sgmsAo9yN2ODb1fns5m6sQ-1 X-Mimecast-MFC-AGG-ID: sgmsAo9yN2ODb1fns5m6sQ_1762920571 Received: by mail-qt1-f200.google.com with SMTP id d75a77b69052e-4edd678b2a3so5149111cf.2 for ; Tue, 11 Nov 2025 20:09:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1762920571; x=1763525371; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:content-language:references :cc:to:subject:user-agent:mime-version:date:message-id:from:from:to :cc:subject:date:message-id:reply-to; bh=jBULf+ZIkA9FqHKiIs1320k4feJF2I1rgP/b6d4F0Mk=; b=ekFg/j6aJfbuCI/fUdbBHYO8FmybPehHCL7m55Fnh0HjygoTnq+HTAe0eYnXO+75oz Fc/b/tdXULJVMhXcohj3c9qQols4VKsA1uFCztCyQgeRvso/io1K3UYQOljc0E7lPLOC a7MkjAXGg5R/2WA/oNYIs38rFTE2fgEU6SPP7l+txRfcjQccaIN3MMVprsaiGheYPSRw 2uSTJBPY6bHhz1IPfk0FC7zX37tPfX7h76Lkz4aggmGZbmos5zAqXRePPhu+9+HUHeRQ 8egx2jc37454HovImtru3UjyT1psiGVYihYQnxj2zGv7G+hS/9k9nQHJj9x/0KlEVR2A g//g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1762920571; x=1763525371; h=content-transfer-encoding:in-reply-to:content-language:references :cc:to:subject:user-agent:mime-version:date:message-id:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=jBULf+ZIkA9FqHKiIs1320k4feJF2I1rgP/b6d4F0Mk=; b=RcbfPfj55rozhddJXpQXxlUmcNbGUUrZGeLKsD3wEsUGyDaHy0Sylsdqn/XOlSd1fE VvUVEDOK2sLhtJijSg5lvlv8RqgW0v8V0jOwmx8ZMyoqWzqCaUI5j2X2w/hbB833xkWK N+XHoKgwc4q+aFZPgBNUL4AJ6N2HjX7LnWumuIDX8zeERVD+K8CRspiPNFMf6CGLOdp3 vhHcvYMZC8woaBvDpCIyZljw5/ZLRnZotgBks9X9gxbRarY58m9/crDNRNzDw9vjt51f JIkbU3LijUQFAphQ4zyUfrrHcuL2Qdbu4IoJvY8tX7GWnrU2v7Wei+LjrYXgX29Sdil5 qkeA== X-Forwarded-Encrypted: i=1; AJvYcCVAzwLgYcwlKgOPwvKHrGwa1/+3FWbaPfsPLYkU+TLFXAM6Fw2JmEkOOxdm26L2ar1wZFeXmJxo@vger.kernel.org X-Gm-Message-State: AOJu0YzT+LaRw1Mt0T+Eq2r4gjnMLRrcHjWaslka6uxQF/mTzT66NNVv V6eIRKjxrGJaAw8kQGDXbFPbRgH0R9ycTBbWmGvuqdQ20TObAR8gX5P+S82C6ZIQ6FvsMDefWWI MVydjruYYu4x7Y1bU9qasSJCnJIWxzAFTg/xLQtbM5ACx1qvV2vT6jUoikHo= X-Gm-Gg: ASbGnct+ASSZaAxXf/i3OidU/u7Y9hhDFrxvsUEi2J1xFKKuIfbLlpLMKudYJbfH9t3 iJZlxt1tmYmwp505QMCsxHuVITuPmYx/sTj+CFuxi0fYrJjbpZqq1rOJna/GseoxwAi/jLRoyow lPoByMPBtHD8+8iLBlmzoJSkK3jgk+W3n5gct6TS4Kh+Qx9yaTZtwB5M7OlQVmb+DZqZn3KQ12r h9b/z+z5km6Fn5EkAx6rI+KOj+yTYOR2iKK5g0QCRzPQl2kDQG08WMixlSa8dcKGzuhVZgwci+t pBfE/36H3Y2fA1eIMRATKvNYx5C+jcJKQ6MrS6tVV4mj13ImScypVejbvLSMxXz/xpt2YNj17H7 jgEAi/dBk7vs7HfZ8NDTnsFcRAKx1jjgHEr7lysaC9qiAdQ== X-Received: by 2002:ac8:5a15:0:b0:4e8:ada0:450a with SMTP id d75a77b69052e-4eddbd774bamr18423771cf.45.1762920571008; Tue, 11 Nov 2025 20:09:31 -0800 (PST) X-Google-Smtp-Source: AGHT+IGPWTMesD++oG9Eb6d/7De7HTmZLuSnw0p9oUBYq3+RbK0SLKI1SdBODf1yz+ndvuVag3fpAg== X-Received: by 2002:ac8:5a15:0:b0:4e8:ada0:450a with SMTP id d75a77b69052e-4eddbd774bamr18423691cf.45.1762920570668; Tue, 11 Nov 2025 20:09:30 -0800 (PST) Received: from ?IPV6:2601:188:c102:b180:1f8b:71d0:77b1:1f6e? ([2601:188:c102:b180:1f8b:71d0:77b1:1f6e]) by smtp.gmail.com with ESMTPSA id d75a77b69052e-4eda563fbfcsm77229701cf.10.2025.11.11.20.09.29 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 11 Nov 2025 20:09:30 -0800 (PST) From: Waiman Long X-Google-Original-From: Waiman Long Message-ID: Date: Tue, 11 Nov 2025 23:09:29 -0500 Precedence: bulk X-Mailing-List: cgroups@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v1] cpuset: Avoid unnecessary partition invalidation To: Chen Ridong , Sun Shaojie Cc: tj@kernel.org, hannes@cmpxchg.org, mkoutny@suse.com, shuah@kernel.org, cgroups@vger.kernel.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org References: <20251112021120.248778-1-sunshaojie@kylinos.cn> <380567da-9079-4a4d-afae-42bde42d2a58@huaweicloud.com> Content-Language: en-US In-Reply-To: <380567da-9079-4a4d-afae-42bde42d2a58@huaweicloud.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit On 11/11/25 10:33 PM, Chen Ridong wrote: > > On 2025/11/12 10:11, Sun Shaojie wrote: > Hello Shaojie, > >> Currently, when a non-exclusive cpuset's "cpuset.cpus" overlaps with a >> partitioned sibling, the sibling's partition state becomes invalid. >> However, this invalidation is often unnecessary. >> >> This can be observed in specific configuration sequences: >> >> Case 1: Partition created first, then non-exclusive cpuset overlaps >> #1> mkdir -p /sys/fs/cgroup/A1 >> #2> echo "0-1" > /sys/fs/cgroup/A1/cpuset.cpus >> #3> echo "root" > /sys/fs/cgroup/A1/cpuset.cpus.partition >> #4> mkdir -p /sys/fs/cgroup/B1 >> #5> echo "0-3" > /sys/fs/cgroup/B1/cpuset.cpus >> // A1's partition becomes "root invalid" - this is unnecessary >> >> Case 2: Non-exclusive cpuset exists first, then partition created >> #1> mkdir -p /sys/fs/cgroup/B1 >> #2> echo "0-1" > /sys/fs/cgroup/B1/cpuset.cpus >> #3> mkdir -p /sys/fs/cgroup/A1 >> #4> echo "0-1" > /sys/fs/cgroup/A1/cpuset.cpus >> #5> echo "root" > /sys/fs/cgroup/A1/cpuset.cpus.partition >> // A1's partition becomes "root invalid" - this is unnecessary >> >> In Case 1, the effective CPU mask of B1 can differ from its requested >> mask. B1 can use CPUs 2-3 which don't overlap with A1's exclusive >> CPUs (0-1), thus not violating A1's exclusivity requirement. >> >> In Case 2, B1 can inherit the effective CPUs from its parent, so there >> is no need to invalidate A1's partition state. >> >> This patch relaxes the overlap check to only consider conflicts between >> partitioned siblings, not between a partitioned cpuset and a regular >> non-exclusive one. >> > Does this rule have any negative impact on your products? > > The CPUs specified by the user (including cpuset.cpus and cpuset.cpus.exclusive) can be treated as > the dedicated exclusive CPUs for the partition. For the cases you provided, both siblings can be > partitions. For example, in case 1, A1 can also be converted to a partition. If this rule is > relaxed, I don’t see any check for exclusive conflicts when A1 becomes a partition. > > Additionally, I think we should preserve the CPU affinity as the user intends as much as possible. Where does the original patch sent to? I didn't see it. Anyway it is late for me. I will take a further look tomorrow. Cheers, Longman