[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <05689bcc-6cfb-4acb-9611-bfbf5e128502@huaweicloud.com>
Date: Fri, 15 Aug 2025 18:29:56 +0800
From: Chen Ridong <chenridong@...weicloud.com>
To: lirongqing <lirongqing@...du.com>, tj@...nel.org, hannes@...xchg.org,
mkoutny@...e.com, cgroups@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] cgroup: Remove redundant rcu_read_lock() in
spin_lock_irq() section
On 2025/8/15 17:14, lirongqing wrote:
> From: Li RongQing <lirongqing@...du.com>
>
> Since spin_lock_irq() already disables preemption and task_css_set()
> is protected by css_set_lock, the rcu_read_lock() calls are unnecessary
> within the critical section. Remove them to simplify the code.
>
> Signed-off-by: Li RongQing <lirongqing@...du.com>
> ---
> kernel/cgroup/cgroup.c | 2 --
> 1 file changed, 2 deletions(-)
>
> diff --git a/kernel/cgroup/cgroup.c b/kernel/cgroup/cgroup.c
> index 312c6a8..db9e00a 100644
> --- a/kernel/cgroup/cgroup.c
> +++ b/kernel/cgroup/cgroup.c
> @@ -2944,14 +2944,12 @@ int cgroup_attach_task(struct cgroup *dst_cgrp, struct task_struct *leader,
>
> /* look up all src csets */
> spin_lock_irq(&css_set_lock);
> - rcu_read_lock();
> task = leader;
> do {
> cgroup_migrate_add_src(task_css_set(task), dst_cgrp, &mgctx);
> if (!threadgroup)
> break;
> } while_each_thread(leader, task);
> - rcu_read_unlock();
> spin_unlock_irq(&css_set_lock);
>
> /* prepare dst csets and commit */
LGTM
--
Best regards,
Ridong
Powered by blists - more mailing lists