mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Paul Menage" <menage@google.com>
To: "Lai Jiangshan" <laijs@cn.fujitsu.com>,
	"Andrew Morton" <akpm@linux-foundation.org>
Cc: "Linux Kernel Mailing List" <linux-kernel@vger.kernel.org>
Subject: Re: [RFC PATCH -mm 2/2] cgroup: fold struct cg_cgroup_link into struct css_set
Date: Thu, 11 Sep 2008 10:50:44 -0700	[thread overview]
Message-ID: <6599ad830809111050h27d22369m8fc4faa47920f784@mail.gmail.com> (raw)
In-Reply-To: <48C929DF.3050009@cn.fujitsu.com>

On Thu, Sep 11, 2008 at 7:23 AM, Lai Jiangshan <laijs@cn.fujitsu.com> wrote:
>
> one struct cg_cgroup_link per link is very waste.
> This way need to allocate struct cg_cgroup_link for
> (css_set_count * hierarchy_count) times.

Correct - but in the common case, hierarchy_count==1. So it's 7
pointers (two list_heads and a pointer in the cg_cgroup_link, and a
list_head in the css_set) per css_set. Each additional hierarchy
introduces 5 pointers per css_set with the new cg_cgroup_link. (So
overall, 2 + 5*H)

We're up to 9 cgroup subsystems in -mm right now, so your approach
consumes 18 pointers (9 list heads) per css_set, regardless of how
many hierarchies are mounted.

So I think that the current solution saves memory when there are fewer
than four hierarchies mounted. As the number of cgroup subsystems
increases, the break-even point will increase. I expect that the most
common number of mounted hierarchies will be 0 (but there's only one
css_set in that case, so the overhead is irrelevant) or 1.

>
> This patch removes lots of line of code. remove struct cg_cgroup_link
> and corresponding code.

Yes, the code is definitely simpler after your patch. It's pretty much
how it was *before* I introduced the cg_cgroup_link structures to
allow an arbitrary number of hierarchies without bloating the css_set
structure. I'm not convinced that we want to go back to the original
way.

Paul

  parent reply	other threads:[~2008-09-11 17:51 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-09-11 14:23 Lai Jiangshan
2008-09-11 14:26 ` Lai Jiangshan
2008-09-11 17:50 ` Paul Menage [this message]
2008-09-15  2:01   ` Lai Jiangshan

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=6599ad830809111050h27d22369m8fc4faa47920f784@mail.gmail.com \
    --to=menage@google.com \
    --cc=akpm@linux-foundation.org \
    --cc=laijs@cn.fujitsu.com \
    --cc=linux-kernel@vger.kernel.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

all inboxes | Powered by JetHome®