From: Tejun Heo <tj-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
To: "zhaoyang.huang"
<zhaoyang.huang-1tVvrHeaX6nQT0dZR+AlfA@public.gmane.org>
Cc: Johannes Weiner <hannes-druUgvl0LCNAfugRpC6u6w@public.gmane.org>,
Michal Hocko <mhocko-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
Zhaoyang Huang
<huangzhaoyang-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
cgroups-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
ke.wang-1tVvrHeaX6nQT0dZR+AlfA@public.gmane.org,
Zefan Li <lizefan.x-EC8Uxl6Npydl57MIdRCFDg@public.gmane.org>
Subject: Re: [RFC PATCH] cgroup: use root_mem_cgroup as css when current is not enabled
Date: Fri, 12 Aug 2022 09:06:14 -1000 [thread overview]
Message-ID: <YvakpukeF9d35Bc8@slm.duckdns.org> (raw)
In-Reply-To: <1660298966-11493-1-git-send-email-zhaoyang.huang-1tVvrHeaX6nQT0dZR+AlfA@public.gmane.org>
On Fri, Aug 12, 2022 at 06:09:26PM +0800, zhaoyang.huang wrote:
> From: Zhaoyang Huang <zhaoyang.huang-1tVvrHeaX6nQT0dZR+AlfA@public.gmane.org>
>
> Memory charged on group B abserved on belowing v2 hierarchy where we just would
> like to only have group E's memory be controlled and B's descendants compete freely
> for memory. This should be the consequences of unified hierarchy. Solve this by
> have the cgroup without valid memory css alloced use root_mem_cgroup instead of
> its ancestor's.
>
> A(subtree_control = memory) - B(subtree_control = NULL) - C()
> \ D()
> - E(subtree_control = memory) - F()
> \ G()
>
> Signed-off-by: Zhaoyang Huang <zhaoyang.huang-1tVvrHeaX6nQT0dZR+AlfA@public.gmane.org>
> ---
> kernel/cgroup/cgroup.c | 8 ++++++++
> 1 file changed, 8 insertions(+)
>
> diff --git a/kernel/cgroup/cgroup.c b/kernel/cgroup/cgroup.c
> index 1779ccd..b29b3f6 100644
> --- a/kernel/cgroup/cgroup.c
> +++ b/kernel/cgroup/cgroup.c
> @@ -533,6 +533,14 @@ static struct cgroup_subsys_state *cgroup_e_css_by_mask(struct cgroup *cgrp,
> * can't test the csses directly. Test ss_mask.
> */
> while (!(cgroup_ss_mask(cgrp) & (1 << ss->id))) {
> + /*
> + * charging to the parent cgroup which hasn't distribute
> + * memory control to its descendants doesn't make sense
> + * especially on cgroup v2, where the parent could be configured
> + * to use memory controller as its sibling want to use it
> + */
> + if (memory_cgrp_id == ss->id)
> + return &root_mem_cgroup->css;
This is gonna be a hard nack. A given cgroup always encompasses all the
resources consumed in its self-including subtree.
Thanks.
--
tejun
next prev parent reply other threads:[~2022-08-12 19:06 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-12 10:09 [RFC PATCH] cgroup: use root_mem_cgroup as css when current is not enabled zhaoyang.huang
[not found] ` <1660298966-11493-1-git-send-email-zhaoyang.huang-1tVvrHeaX6nQT0dZR+AlfA@public.gmane.org>
2022-08-12 19:06 ` Tejun Heo [this message]
[not found] ` <YvakpukeF9d35Bc8-NiLfg/pYEd1N0TnZuCh8vA@public.gmane.org>
2022-08-14 6:40 ` Zhaoyang Huang
[not found] ` <CAGWkznG6n=+v7hUKR8Rmg8VEF=BTDegk8bh6aHfvOU5TbmeXDw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2022-08-15 1:38 ` Zhaoyang Huang
[not found] ` <CAGWkznHa9WTV2oK=HB1OVEdKeMZ1V2omDDiNrRdyBdyYd=q5Fg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2022-08-15 9:17 ` Zhaoyang Huang
[not found] ` <CAGWkznEQ_njmNt8usr-DyaiYDAHJE-niC2QxoXPQkDqY7v_Mqg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2022-08-15 20:12 ` Tejun Heo
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=YvakpukeF9d35Bc8@slm.duckdns.org \
--to=tj-dgejt+ai2ygdnm+yrofe0a@public.gmane.org \
--cc=cgroups-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=hannes-druUgvl0LCNAfugRpC6u6w@public.gmane.org \
--cc=huangzhaoyang-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
--cc=ke.wang-1tVvrHeaX6nQT0dZR+AlfA@public.gmane.org \
--cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=lizefan.x-EC8Uxl6Npydl57MIdRCFDg@public.gmane.org \
--cc=mhocko-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
--cc=zhaoyang.huang-1tVvrHeaX6nQT0dZR+AlfA@public.gmane.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox