Linux cgroups development
 help / color / mirror / Atom feed
From: Guopeng Zhang <guopeng.zhang@linux.dev>
To: Karl Mehltretter <kmehltretter@gmail.com>, stable@vger.kernel.org
Cc: "Waiman Long" <longman@redhat.com>,
	"Ridong Chen" <ridong.chen@linux.dev>,
	"Tejun Heo" <tj@kernel.org>,
	"Johannes Weiner" <hannes@cmpxchg.org>,
	"Michal Koutný" <mkoutny@suse.com>,
	"Guopeng Zhang" <zhangguopeng@kylinos.cn>,
	"Chen Ridong" <chenridong@huaweicloud.com>,
	"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
	"Sasha Levin" <sashal@kernel.org>,
	cgroups@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 6.6.y] cgroup/cpuset: Fix misplaced DL migration reset
Date: Thu, 3 Sep 2026 21:23:10 +0800	[thread overview]
Message-ID: <bc489900-c67f-4b93-940a-86e16ba1cfdf@linux.dev> (raw)
In-Reply-To: <20260901122642.11571-1-kmehltretter@gmail.com>



在 2026/9/1 20:26, Karl Mehltretter 写道:
> Mainline commit 4a39eda5fdd8 ("cgroup/cpuset: Reset DL migration state
> on can_attach() failure") puts the common error cleanup in
> cpuset_can_attach().  The 6.6.y backport instead placed that hunk at
> cpuset_can_fork()'s similarly named out_unlock label, while removing
> cpuset_can_attach()'s two existing targeted resets.
> 
> If cpuset_can_attach() fails after accounting a SCHED_DEADLINE task,
> cgroup_migrate_execute() does not call cpuset_cancel_attach() for the
> failing subsystem.  The temporary migration fields remain set, and a
> later successful migration can consume the stale state and corrupt
> deadline-task and pending-bandwidth accounting.
> 
> Move the reset to cpuset_can_attach()'s common error exit.  It is not
> needed in cpuset_can_fork(), which never accumulates migration DL state.
> 
> Fixes: 14897ef9341c ("cgroup/cpuset: Reset DL migration state on can_attach() failure")
> Assisted-by: LLM
> Signed-off-by: Karl Mehltretter <kmehltretter@gmail.com>
> ---
> Applies to Linux 6.6.155 and 6.6.156-rc1.
> 
> A controlled QEMU A/B on 6.6.155 forced an attach error after accounting a
> real SCHED_DEADLINE task.  The affected kernel returned with
> nr_migrate_dl_tasks=1 and sum_migrate_dl_bw=104857; both fields were zero
> with this patch.
> 
> The equivalent 6.1.y correction is submitted separately.
> 
>  kernel/cgroup/cpuset.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/kernel/cgroup/cpuset.c b/kernel/cgroup/cpuset.c
> index f9c7178f51ada..bb413045d1744 100644
> --- a/kernel/cgroup/cpuset.c
> +++ b/kernel/cgroup/cpuset.c
> @@ -2630,6 +2630,8 @@ static int cpuset_can_attach(struct cgroup_taskset *tset)
>  	 */
>  	cs->attach_in_progress++;
>  out_unlock:
> +	if (ret)
> +		reset_migrate_dl_data(cs);
>  	mutex_unlock(&cpuset_mutex);
>  	return ret;
>  }
> @@ -3462,8 +3464,6 @@ static int cpuset_can_fork(struct task_struct *task, struct css_set *cset)
>  	cs->attach_in_progress++;
>  
>  out_unlock:
> -	if (ret)
> -		reset_migrate_dl_data(cs);
>  	mutex_unlock(&cpuset_mutex);
>  	return ret;
>  }

Acked-by: Guopeng Zhang <zhangguopeng@kylinos.cn>

      parent reply	other threads:[~2026-09-03 13:23 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-01 12:26 [PATCH 6.6.y] cgroup/cpuset: Fix misplaced DL migration reset Karl Mehltretter
2026-09-02 22:14 ` Sasha Levin
2026-09-03 13:23 ` Guopeng Zhang [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bc489900-c67f-4b93-940a-86e16ba1cfdf@linux.dev \
    --to=guopeng.zhang@linux.dev \
    --cc=cgroups@vger.kernel.org \
    --cc=chenridong@huaweicloud.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=hannes@cmpxchg.org \
    --cc=kmehltretter@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=longman@redhat.com \
    --cc=mkoutny@suse.com \
    --cc=ridong.chen@linux.dev \
    --cc=sashal@kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=tj@kernel.org \
    --cc=zhangguopeng@kylinos.cn \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox