Re: [PATCH] cgroup: Return if dst_cgrp equals to src_cgrp

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, May 26, 2022 at 12:40:17PM +0800, 史思远 <shisiyuan19870131@xxxxxxxxx> 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



[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]     [Monitors]

  Powered by Linux