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 4DDB5153BE9 for ; Fri, 10 Jul 2026 03:48:10 +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=1783655291; cv=none; b=diIeK8VtiB/GWbapB1ACBUzzXAMV0ghba1uci6aamWRjNllUZPJ/Myx5VxXBiaUQGDSFJt1sl6udki5PoQkmuJYSk98v0SgNcPph5K2aqyZs7ndQpc3CoSQi8v+MMmfcm1HngI+JqbQQy6JHusKOa3TdxTLop8J9esfzTDpfci8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783655291; c=relaxed/simple; bh=/Fd6KrNmo6PySHgGRsYcL5y0JMVCNUErPiaGXKyuEQE=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=gS8EChkalaV2102eybgqVaD0KUQkBhzUmfOMmPw8aZPsOV8GsVxsMYW/H/VOD9ptD2wIHCvKdUWdSRcS5pg84jQmFFHJoA1CFhJON8O4cA9eDDjNCxfbFuZBWZE5Xl8KFd9+BQojeyIZBoNT4vBHMmgyQ7i7z9AZXyqDPOYidb0= 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=DMZxgf6A; 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="DMZxgf6A" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1783655289; 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=kTM73mbrNFeg9NAnrcfOYiEcBbQPeq+yx3xgufQSvnQ=; b=DMZxgf6AgiwwdRo113C2TjapjBCODhEMIv2dH52Cjoy1PcUnIIMHzYFrTUb4slIB32FLt7 I1UUIJ0dSXQHPG9IZz2KcMs26f8uVtrkZIvXAzZxfhoe8feMocP9puuPCNoeN7z6wDbevl 1koz+Q9aaYCAUoOPzJumQBobTnxV77I= 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-711-3xlsM3t9O3uzBfC4kNmdZg-1; Thu, 09 Jul 2026 23:48:07 -0400 X-MC-Unique: 3xlsM3t9O3uzBfC4kNmdZg-1 X-Mimecast-MFC-AGG-ID: 3xlsM3t9O3uzBfC4kNmdZg_1783655286 Received: from mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.93]) (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 89EB01956042; Fri, 10 Jul 2026 03:48:05 +0000 (UTC) Received: from [10.22.80.240] (unknown [10.22.80.240]) by mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 7172A1800348; Fri, 10 Jul 2026 03:48:03 +0000 (UTC) Message-ID: Date: Thu, 9 Jul 2026 23:48:02 -0400 Precedence: bulk X-Mailing-List: linux-kselftest@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH-next v10 10/11] cgroup/cpuset: Support multiple destination cpusets for cpuset_*attach() To: Tejun Heo Cc: Ridong Chen , Johannes Weiner , =?UTF-8?Q?Michal_Koutn=C3=BD?= , Shuah Khan , Juri Lelli , cgroups@vger.kernel.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, Aaron Tomlin , Guopeng Zhang References: <20260702214757.579012-1-longman@redhat.com> <20260702214757.579012-11-longman@redhat.com> Content-Language: en-US From: Waiman Long In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.93 On 7/6/26 8:57 PM, Tejun Heo wrote: > Hello, Waiman. > > On Thu, Jul 02, 2026 at 05:47:56PM -0400, Waiman Long wrote: >> It is assumed that a given cpuset cannot be both a source and a >> destination cpuset. [...] it will print a warning and fail the attach >> operation in these unexpected cases [...] > This assumption doesn't hold - the WARN_ON_ONCE() and -EINVAL fire on a > legitimate migration. It's the case sashiko flagged, and it does reach > can_attach(). > > Threaded subtree with partial cpuset delegation: > > P (+cpuset) > |- R (cpuset) <- destination > | `- C (no cpuset) -> effective cpuset == R > `- W (cpuset) > > Group leader in R, thread_a in C, thread_b in W; migrate the whole > process into R (echo $PID > R/cgroup.procs). thread_a moves C->R: its > cgroup changes so compare_css_sets() keeps it in the taskset, but its > cpuset css is unchanged (C inherits R's), so task_cs() == cs == R. cpuset > is in ss_mask because thread_b (W->R) changed. can_attach() then tags R > as a source (thread_a) and the destination (thread_b): > > WARNING: kernel/cgroup/cpuset.c:3054 at cpuset_can_attach_check+0xcd/0x130 > cpuset_can_attach+0x131/0x2f0 > cgroup_migrate_execute+0x367/0x450 > cgroup.procs write returns -EINVAL > > So a thread already in the destination's effective cpuset does show up in > the iteration when it reaches that cpuset through a different, non-cpuset > child - compare_css_sets() keys on the cgroup, not the cpuset css. > > 1-9 handle this correctly (the migration succeeds); the patch 10 guard > regresses it. I've taken 1-9 into for-7.3 - please respin 10-11. One > option: when oldcs == cs the pair is a cpuset no-op, so skip it and add > it to neither list. Sorry for the late reply. I was offline for a few days because my labtop SSD was having problem. Yes, I realize that my assumption about oldcs != cs is incorrect. I will revise the remaining patch to address the issue. Thanks, Longman