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.129.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 CDDEE12D21B for ; Sat, 16 May 2026 04:36:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778906178; cv=none; b=OpmOdAr84zppytANMc6Mo2nMRgYR6Msn3MU+LMJoWSMfDiVYcminHFCZ9Q8UE9XlSCe3QZLhp3kC16maqHvkkvCD6sYfDk1pSi/rnY/AzvD6XqK482n0H1jp1Ty4e0fNECOh3PCL26heTgJZ+6eb06Au57Ksfqw95CIkMcJzSJ4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778906178; c=relaxed/simple; bh=EumMv958u6WFgQoAbYddJahq8sxAYgschaxIgCjxmI4=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=kxOc9ZKqyIOMW1AK/poMOVK8l4s/SaTBDV3gbFxJN0lTd7RmkQoEz4yhTyTTqNG2kiG+CjUS19byuDxaBKrf0RwDyIMfRlktoUc9IDWJj4qKMXYTDk8hAij97Hkgm+Ds2mPTRWKDX6v+ku234QZ5o+4kyAwy+3qYxTvkq3WhIpY= 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=X1dcd2BP; arc=none smtp.client-ip=170.10.129.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="X1dcd2BP" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1778906175; 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=bgnrVTKye5LKooEivoS4UZIbyKmBRGGYjO2dcA8RwEg=; b=X1dcd2BPaUwNRvBPy07QROhjvY9Zrvm2FtjxRAN7i7zKmbtiarALmmdxrQAX//vyldRN99 twoxHWkT3qaqEdOolDnmazCpvqkQedPMvI/AUSmgM6O4sTWQUZX2knqyi7EgKHLFI4NQtB Ebl1fhSTf3L2he46D1WGkQ2owUPzwxQ= Received: from mx-prod-mc-05.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-43-TqtxovQTM8Ktmk-2YBmC6w-1; Sat, 16 May 2026 00:36:12 -0400 X-MC-Unique: TqtxovQTM8Ktmk-2YBmC6w-1 X-Mimecast-MFC-AGG-ID: TqtxovQTM8Ktmk-2YBmC6w_1778906168 Received: from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17]) (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-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 0F7EE1956080; Sat, 16 May 2026 04:36:08 +0000 (UTC) Received: from [10.2.16.156] (unknown [10.2.16.156]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 796001956053; Sat, 16 May 2026 04:36:02 +0000 (UTC) Message-ID: <318fc8b9-87d1-4288-9881-7a83a521b2c2@redhat.com> Date: Sat, 16 May 2026 00:36:02 -0400 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 cgroup/for-next v2 0/5] cgroup/cpuset: Support multiple source/destination cpusets for cpuset_*attach() To: Chen Ridong , Tejun Heo , Johannes Weiner , =?UTF-8?Q?Michal_Koutn=C3=BD?= , Ingo Molnar , Peter Zijlstra , Juri Lelli , Vincent Guittot , Dietmar Eggemann , Steven Rostedt , Ben Segall , Mel Gorman , Valentin Schneider , K Prateek Nayak Cc: cgroups@vger.kernel.org, linux-kernel@vger.kernel.org, Aaron Tomlin References: <20260516042448.698216-1-longman@redhat.com> Content-Language: en-US From: Waiman Long In-Reply-To: <20260516042448.698216-1-longman@redhat.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 On 5/16/26 12:24 AM, Waiman Long wrote: > 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 adds a new attach_old_cs field into task_struct to track the > old cpuset to be used in case when cpuset_migrate_mm() needs to be > called in cpuset_attach(). > > 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. Sorry, I forgot to add the change log. It is basically to address all the AI review comments [1] for my v1 patch. The 2 major changes are to move cpuset_migrate_mm() into cpuset_attach_task() and add a new field in task_struct to record the old cpuset to be used by cpuset_migrate_mm(). There also some other minor changes. [1] https://lore.kernel.org/lkml/4f49602d35d987e029b8e92a577f0c60@kernel.org/ Cheers, Longman > > Waiman Long (5): > cgroup/cpuset: Add a cpuset_reserve_dl_bw() helper > cgroup/cpuset: Expand the scope of cpuset_can_attach_check() > cgroup/cpuset: Replace cpuset_attach_old_cs by a new attach_old_cs > field in task_struct > cgroup/cpuset: Move mpol_rebind_mm/cpuset_migrate_mm() calls inside > cpuset_attach_task() > cgroup/cpuset: Support multiple source/destination cpusets for > cpuset_*attach() > > include/linux/sched.h | 3 + > kernel/cgroup/cpuset-internal.h | 6 + > kernel/cgroup/cpuset.c | 358 +++++++++++++++++++++----------- > 3 files changed, 249 insertions(+), 118 deletions(-) >