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 953763FE361 for ; Thu, 7 May 2026 14:31: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=1778164277; cv=none; b=eg7SdGCLV+wQqun03DdZqcsEoRE2dWuZuBOUVd66PfWZgGv6G8aUlZ/nH+8Q9x9RX1mb24/A3jdCSFwomfqyVonm21OAWAXe7+y5w/pVKpuPcmkRdMPOJn7uHW5b4Gbqh0+vH9mP1k+acwy2NJdkPMAnpmLkodFJrxee82ZZpLg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778164277; c=relaxed/simple; bh=xdxmQytP/UzokOhHCLRQJRAGp72jp0MEug8OKlI0hKc=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=j60GdQgcvlO2miTc/hEBO+ZZoOcZTGqpfErvSG3VsYL/3P/RZ3qjebd1QGCM+wXCqNUPIZkrN5HDVBsEgv84kXEiZ6cZjcLS6vA98AfJR/PBPoN/mQ0iFlsU0uya2wfi55yKrlOU8WJrqolgIuqAllLkMJnhjCQG5sIZxnBnRcY= 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=bdSQuxJC; 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="bdSQuxJC" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1778164275; 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=kNaiWR+eqSu7WO4M7F1ji4bzG7ml343gIkmWsIUgsNs=; b=bdSQuxJCIhY8miZqxQveBsjg6yxYjU7lUkwqTg56gUf6fiK2NRpHZbvQeGJgtDtzyR5Ojj abRX10KCaPaBy2paoJPBNMPQe/YiVDSCiF3tHrqhD6xtAzgsI6CZPrlNC4b/uUQsa+kil3 /kunChuAvNrIY0NhmMr8KcI1YdDXvQA= Received: from mx-prod-mc-01.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-205-Ix9Co-CvOh-DT0l8et_Qww-1; Thu, 07 May 2026 10:31:11 -0400 X-MC-Unique: Ix9Co-CvOh-DT0l8et_Qww-1 X-Mimecast-MFC-AGG-ID: Ix9Co-CvOh-DT0l8et_Qww_1778164269 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-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id E91F519560A7; Thu, 7 May 2026 14:31:07 +0000 (UTC) Received: from [10.2.16.64] (unknown [10.2.16.64]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id F17981801A63; Thu, 7 May 2026 14:31:01 +0000 (UTC) Message-ID: <6410d11c-1d8a-4e72-ac22-43058027b304@redhat.com> Date: Thu, 7 May 2026 10:31:00 -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 v2 1/2] cgroup/cpuset: reset DL migration state on can_attach() failure To: Guopeng Zhang , Tejun Heo , =?UTF-8?Q?Michal_Koutn=C3=BD?= , Ingo Molnar , Peter Zijlstra , Juri Lelli Cc: Chen Ridong , Johannes Weiner , Vincent Guittot , Dietmar Eggemann , Steven Rostedt , Ben Segall , Mel Gorman , Valentin Schneider , K Prateek Nayak , Gabriele Monaco , Will Deacon , linux-kernel@vger.kernel.org, cgroups@vger.kernel.org References: <20260507103310.35849-1-zhangguopeng@kylinos.cn> <20260507103310.35849-2-zhangguopeng@kylinos.cn> Content-Language: en-US From: Waiman Long In-Reply-To: <20260507103310.35849-2-zhangguopeng@kylinos.cn> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.111 On 5/7/26 6:33 AM, Guopeng Zhang wrote: > cpuset_can_attach() accumulates temporary SCHED_DEADLINE migration > state in the destination cpuset while walking the taskset. > > If a later task_can_attach() or security_task_setscheduler() check > fails, cgroup_migrate_execute() treats cpuset as the failing subsystem > and does not call cpuset_cancel_attach() for it. The partially > accumulated state is then left behind and can be consumed by a later > attach, corrupting cpuset DL task accounting and pending DL bandwidth > accounting. > > Reset the pending DL migration state before returning from those > per-task failure paths. > > Fixes: 2ef269ef1ac0 ("cgroup/cpuset: Free DL BW in case can_attach() fails") > Signed-off-by: Guopeng Zhang > --- > kernel/cgroup/cpuset.c | 8 ++++++-- > 1 file changed, 6 insertions(+), 2 deletions(-) > > diff --git a/kernel/cgroup/cpuset.c b/kernel/cgroup/cpuset.c > index e3a081a07c6d..ae41736399a1 100644 > --- a/kernel/cgroup/cpuset.c > +++ b/kernel/cgroup/cpuset.c > @@ -3029,12 +3029,12 @@ static int cpuset_can_attach(struct cgroup_taskset *tset) > cgroup_taskset_for_each(task, css, tset) { > ret = task_can_attach(task); > if (ret) > - goto out_unlock; > + goto out_reset_dl_data; > > if (setsched_check) { > ret = security_task_setscheduler(task); > if (ret) > - goto out_unlock; > + goto out_reset_dl_data; > } > > if (dl_task(task)) { > @@ -3070,6 +3070,10 @@ static int cpuset_can_attach(struct cgroup_taskset *tset) > * changes which zero cpus/mems_allowed. > */ > cs->attach_in_progress++; > + goto out_unlock; > + > +out_reset_dl_data: > + reset_migrate_dl_data(cs); > out_unlock: > mutex_unlock(&cpuset_mutex); > return ret; I would prefer the likely success path be a straight line instead of doing a goto. IOW, move out_reset_dl_data below return. Other than that, this patch looks good to me. Cheers, Longman