mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH -next] cgroup/pids: remove pids_cancel_attach
@ 2024-05-17  1:30 Chen Ridong
  2024-05-17  1:46 ` Tejun Heo
  0 siblings, 1 reply; 3+ messages in thread
From: Chen Ridong @ 2024-05-17  1:30 UTC (permalink / raw)
  To: tj, lizefan.x, hannes; +Cc: cgroups, linux-kernel, cyphar

In pids subsystem, pids_can_attach never returns an error.
Therefore, pids_cancel_attach is unnecessary and is never called.
As a result, it should be removed.

Signed-off-by: Chen Ridong <chenridong@huawei.com>
---
 kernel/cgroup/pids.c | 19 -------------------
 1 file changed, 19 deletions(-)

diff --git a/kernel/cgroup/pids.c b/kernel/cgroup/pids.c
index 0e5ec7d59b4d..a7a719495547 100644
--- a/kernel/cgroup/pids.c
+++ b/kernel/cgroup/pids.c
@@ -211,24 +211,6 @@ static int pids_can_attach(struct cgroup_taskset *tset)
 	return 0;
 }
 
-static void pids_cancel_attach(struct cgroup_taskset *tset)
-{
-	struct task_struct *task;
-	struct cgroup_subsys_state *dst_css;
-
-	cgroup_taskset_for_each(task, dst_css, tset) {
-		struct pids_cgroup *pids = css_pids(dst_css);
-		struct cgroup_subsys_state *old_css;
-		struct pids_cgroup *old_pids;
-
-		old_css = task_css(task, pids_cgrp_id);
-		old_pids = css_pids(old_css);
-
-		pids_charge(old_pids, 1);
-		pids_uncharge(pids, 1);
-	}
-}
-
 /*
  * task_css_check(true) in pids_can_fork() and pids_cancel_fork() relies
  * on cgroup_threadgroup_change_begin() held by the copy_process().
@@ -375,7 +357,6 @@ struct cgroup_subsys pids_cgrp_subsys = {
 	.css_alloc	= pids_css_alloc,
 	.css_free	= pids_css_free,
 	.can_attach 	= pids_can_attach,
-	.cancel_attach 	= pids_cancel_attach,
 	.can_fork	= pids_can_fork,
 	.cancel_fork	= pids_cancel_fork,
 	.release	= pids_release,
-- 
2.34.1


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH -next] cgroup/pids: remove pids_cancel_attach
  2024-05-17  1:30 [PATCH -next] cgroup/pids: remove pids_cancel_attach Chen Ridong
@ 2024-05-17  1:46 ` Tejun Heo
  2024-05-17  1:56   ` 答复: " chenridong
  0 siblings, 1 reply; 3+ messages in thread
From: Tejun Heo @ 2024-05-17  1:46 UTC (permalink / raw)
  To: Chen Ridong; +Cc: lizefan.x, hannes, cgroups, linux-kernel, cyphar

On Fri, May 17, 2024 at 01:30:01AM +0000, Chen Ridong wrote:
> In pids subsystem, pids_can_attach never returns an error.
> Therefore, pids_cancel_attach is unnecessary and is never called.
> As a result, it should be removed.

There are subsystems which can tho and if pids is being migrated together,
its cancel will be called.

Thanks.

-- 
tejun

^ permalink raw reply	[flat|nested] 3+ messages in thread

* 答复: [PATCH -next] cgroup/pids: remove pids_cancel_attach
  2024-05-17  1:46 ` Tejun Heo
@ 2024-05-17  1:56   ` chenridong
  0 siblings, 0 replies; 3+ messages in thread
From: chenridong @ 2024-05-17  1:56 UTC (permalink / raw)
  To: Tejun Heo; +Cc: lizefan.x, hannes, cgroups, linux-kernel, cyphar

See, thank you.

-----邮件原件-----
发件人: Tejun Heo <htejun@gmail.com> 代表 Tejun Heo
发送时间: 2024年5月17日 9:46
收件人: chenridong <chenridong@huawei.com>
抄送: lizefan.x@bytedance.com; hannes@cmpxchg.org; cgroups@vger.kernel.org; linux-kernel@vger.kernel.org; cyphar@cyphar.com
主题: Re: [PATCH -next] cgroup/pids: remove pids_cancel_attach

On Fri, May 17, 2024 at 01:30:01AM +0000, Chen Ridong wrote:
> In pids subsystem, pids_can_attach never returns an error.
> Therefore, pids_cancel_attach is unnecessary and is never called.
> As a result, it should be removed.

There are subsystems which can tho and if pids is being migrated together, its cancel will be called.

Thanks.

--
tejun

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-05-17  1:56 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-05-17  1:30 [PATCH -next] cgroup/pids: remove pids_cancel_attach Chen Ridong
2024-05-17  1:46 ` Tejun Heo
2024-05-17  1:56   ` 答复: " chenridong

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®