lkml.org 
[lkml]   [2022]   [May]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] cgroup: Return if dst_cgrp equals to src_cgrp
On Thu, May 26, 2022 at 12:40:17PM +0800, 史思远 <shisiyuan19870131@gmail.com> wrote:
> echo 1413 > /dev/cpuset/foreground/cgroup.procs
> echo 1413 > /dev/cpuset/foreground/cgroup.procs
> echo 1413 > /dev/cpuset/foreground/cgroup.procs

Thank you.

> In this situation, since the second echo, dst_cgrp equals to src_cgrp(both
> cgroups are the 'foreground' cpuset).
> cgroup1_procs_write()-> __cgroup1_procs_write()
> -> cgrp = cgroup_kn_lock_live()
> -> task = cgroup_procs_write_start(buf...)
> -> cgroup_attach_task(cgrp, task, threadgroup);
> -> 1) cgroup_migrate_add_src(task_css_set(task), dst_cgrp, &mgctx); //
> detect the (src_cgrp == dst_cgrp), don't need to continue the following
> migration flow.
> -> 2) cgroup_migrate_prepare_dst(&mgctx)

Here, I'd like to let you know about [1]

> -> 3) cgroup_migrate(leader, threadgroup, &mgctx)
> -> 4) cgroup_migrate_finish(&mgctx) // cleanup
> -> cgroup_procs_write_finish(); // cleanup


> >> The main purpose for this patch is to handle the situation above, and
> just noticed that cgroup_update_dfl_csses() also
> calls cgroup_migrate_add_src(). So I assume it's a similar situation. We
> can discuss more about it.

So I think the patch doesn't save that much and identical css_set is
better condition to check on (covers cgroup_update_dfl_csses too).

Michal

[1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/kernel/cgroup/cgroup.c?h=v5.18#n2710

\
 
 \ /
  Last update: 2022-05-26 13:23    [W:0.042 / U:0.228 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site