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 C79FA2D9EDC for ; Wed, 27 May 2026 15:38:50 +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=1779896332; cv=none; b=VBvp+L790o3xRtJsxO8evlEiYmjdhdtgKj3Qek+N+JZIQmHpBxDpNYSv8+dXb9tXsckpijLp8FFb2uPrvWem5LxYMDcYtg0tq9hYuSFKjjFANLO3ipHSp2lp6rPTIBBv9+Gs08mn8LjlgEqyVoVdV3s1QSweSKspIn3v/Akt0Ow= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779896332; c=relaxed/simple; bh=t47uX9LfNk/VS3b0UOzJFpGA6+4KBzYW1wQwcbN010E=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=uS8R896SFMcaj2b4ELS8JHPfDvrseoSpPRreU/16c6YxaXdrpn80fO2y5TIFko+HUZOxX+Pbb3rINqoVx1p0jF2+I/ymLpgDlQ7/xpiZlnPBe72FvceFbUcx9AbaN39sFIQ2TScITEFZAmJvHas3whMEE1aDOxrhPv9EtnFMX8o= 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=dGbgJJsb; 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="dGbgJJsb" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1779896330; 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; bh=F12bV2mWWMDi602T7nrlB9gUt0uM29kW2bkxAW2G9zE=; b=dGbgJJsbhVmlbtJqQWInWgsr5ilfPQtiVFa/6LjyrHXSIhTqSrKHm0iTHtMzmLAeGAla4i i1n4iIBPsQaA4sT3IImgU3kIJmG6DqMHh+dcx/z9p5rEKELLPVZ310URS5pHQ1DNi9k6OH Q0CgwSJT9/fy1CUQnpjOMBc9qevacqc= Received: from mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-472-zwbd547OO9aHaS3dHadGVw-1; Wed, 27 May 2026 11:38:45 -0400 X-MC-Unique: zwbd547OO9aHaS3dHadGVw-1 X-Mimecast-MFC-AGG-ID: zwbd547OO9aHaS3dHadGVw_1779896324 Received: from mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.111]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 5BB9819560B7; Wed, 27 May 2026 15:38:43 +0000 (UTC) Received: from llong-thinkpadp16vgen1.westford.csb (unknown [10.22.81.53]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 3DC631800465; Wed, 27 May 2026 15:38:40 +0000 (UTC) From: Waiman Long To: Chen Ridong , Tejun Heo , Johannes Weiner , =?UTF-8?q?Michal=20Koutn=C3=BD?= , Ingo Molnar , Peter Zijlstra Cc: cgroups@vger.kernel.org, linux-kernel@vger.kernel.org, Aaron Tomlin , Waiman Long Subject: [PATCH-next v3 0/5] cgroup/cpuset: Support multiple source/destination cpusets for cpuset_*attach() Date: Wed, 27 May 2026 11:37:55 -0400 Message-ID: <20260527153800.1557449-1-longman@redhat.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.111 v3: - Rebased to the lastest linux-next tree. - Keep cpuset_attach_old_cs as suggested by Chen Ridong and replace patch 3 by a new one to make it track task group leader. Sashiko AI review of another cpuset patch had found that cpuset_attach() and cpuset_can_attach() can be passed a cgroup_taskset with tasks migrating from one source cpuset to multiple destination cpusets and vice versa. Further testing of the cpuset code indicates that this is indeed the case when the v2 cpuset controller is enabled or disabled. Unfortunately, cpuset_attach() and cpuset_can_attach() still assume that there will be one source and one destinaton cpuset which may result in inocrrect behavior. This patch series is created to fix this issue. The first 2 patches are just preparatory patches to make the remaining patches easier to review. Patch 3 makes cpuset_attach_old_cs to track group leader for use by cpuset_migrate_mm(). Patch 4 moves mpol_rebind_mm() and cpuset_migrate_mm() inside cpuset_attach_task() to make CLONE_INTO_CGROUP flag of clone(2) works more like moving task from one cpuset to another one, while also make supporting multiple source and destination cpusets easier. Patch 5 makes the necessary changes to enable the support of multiple source and destination cpusets by keeping all the source and destination cpusets found during task iterations in two singly linked lists for source and destination cpusets respectively. Waiman Long (5): cgroup/cpuset: Add a cpuset_reserve_dl_bw() helper cgroup/cpuset: Expand the scope of cpuset_can_attach_check() cgroup/cpuset: Made cpuset_attach_old_cs track task group leaders cgroup/cpuset: Move mpol_rebind_mm/cpuset_migrate_mm() calls inside cpuset_attach_task() cgroup/cpuset: Support multiple source/destination cpusets for cpuset_*attach() kernel/cgroup/cpuset-internal.h | 6 + kernel/cgroup/cpuset.c | 375 ++++++++++++++++++++++---------- 2 files changed, 263 insertions(+), 118 deletions(-) -- 2.54.0