lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Date:   Thu, 26 May 2022 13:22:28 +0200
From:   Michal Koutný <mkoutny@...e.com>
To:     史思远 <shisiyuan19870131@...il.com>
Cc:     Tejun Heo <tj@...nel.org>, Li Zefan <lizefan@...wei.com>,
        Johannes Weiner <hannes@...xchg.org>, cgroups@...r.kernel.org,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH] cgroup: Return if dst_cgrp equals to src_cgrp

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ