From: Tejun Heo <tj-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
To: Johannes Weiner <hannes-druUgvl0LCNAfugRpC6u6w@public.gmane.org>
Cc: Michal Hocko <mhocko-AlSwsSmVLrQ@public.gmane.org>,
bsingharora-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org,
cgroups-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
linux-mm-Bw31MaZKKs3YtjvyW6yDsg@public.gmane.org,
lizefan-hv44wF8Li93QT0dZR+AlfA@public.gmane.org
Subject: Re: [PATCH 3/3] memcg: simplify mem_cgroup_reclaim_iter
Date: Wed, 5 Jun 2013 10:22:12 -0700 [thread overview]
Message-ID: <20130605172212.GA10693@mtj.dyndns.org> (raw)
In-Reply-To: <20130605143949.GQ15576-druUgvl0LCNAfugRpC6u6w@public.gmane.org>
Hey, Johannes.
On Wed, Jun 05, 2013 at 10:39:49AM -0400, Johannes Weiner wrote:
> 5k cgroups * say 10 priority levels * 1k struct mem_cgroup may pin 51M
> of dead struct mem_cgroup, plus whatever else the css pins.
Yeah, it seems like it can grow quite a bit.
> > I'll get to the barrier thread but really complex barrier dancing like
> > that is only justifiable in extremely hot paths a lot of people pay
> > attention to. It doesn't belong inside memcg proper. If the cached
> > amount is an actual concern, let's please implement a simple clean up
> > thing. All we need is a single delayed_work which scans the tree
> > periodically.
> >
> > Johannes, what do you think?
>
> While I see your concerns about complexity (and this certainly is not
> the most straight-forward code), I really can't get too excited about
> asynchroneous garbage collection, even worse when it's time-based. It
> would probably start out with less code but two releases later we
> would have added all this stuff that's required to get the interaction
> right and fix unpredictable reclaim disruption that hits when the
> reaper coincides just right with heavy reclaim once a week etc. I
> just don't think that asynchroneous models are simpler than state
> machines. Harder to reason about, harder to debug.
Agreed, but we can do the cleanup from ->css_offline() as Michal
suggested. Naively implemented, this will lose the nice property of
keeping the iteration point even when the cursor cgroup is removed,
which can be an issue if we're actually worrying about cases with 5k
cgroups continuously being created and destroyed. Maybe we can make
it point to the next cgroup to visit rather than the last visited one
and update it from ->css_offline().
> Now, there are separate things that add complexity to our current
> code: the weak pointers, the lockless iterator, and the fact that all
> of it is jam-packed into one monolithic iterator function. I can see
> why you are not happy. But that does not mean we have to get rid of
> everything wholesale.
>
> You hate the barriers, so let's add a lock to access the iterator.
> That path is not too hot in most cases.
>
> On the other hand, the weak pointer is not too esoteric of a pattern
> and we can neatly abstract it into two functions: one that takes an
> iterator and returns a verified css reference or NULL, and one to
> invalidate pointers when called from the memcg destruction code.
>
> These two things should greatly simplify mem_cgroup_iter() while not
> completely abandoning all our optimizations.
>
> What do you think?
I really think the weak pointers should go especially as we can
achieve about the same thing with normal RCU dereference. Also, I'm a
bit confused about what you're suggesting. If we have invalidation
from offline, why do we need weak pointers?
Thanks.
--
tejun
next prev parent reply other threads:[~2013-06-05 17:22 UTC|newest]
Thread overview: 42+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-06-04 0:44 [PATCHSET] memcg: fix and reimplement iterator Tejun Heo
[not found] ` <1370306679-13129-1-git-send-email-tj-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2013-06-04 0:44 ` [PATCH 1/3] memcg: fix subtle memory barrier bug in mem_cgroup_iter() Tejun Heo
2013-06-04 13:03 ` Michal Hocko
[not found] ` <20130604130336.GE31242-2MMpYkNvuYDjFM9bn6wA6Q@public.gmane.org>
2013-06-04 13:58 ` Johannes Weiner
2013-06-04 15:29 ` Michal Hocko
2013-06-04 0:44 ` [PATCH 2/3] memcg: restructure mem_cgroup_iter() Tejun Heo
[not found] ` <1370306679-13129-3-git-send-email-tj-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2013-06-04 13:21 ` Michal Hocko
2013-06-04 20:51 ` Tejun Heo
2013-06-04 0:44 ` [PATCH 3/3] memcg: simplify mem_cgroup_reclaim_iter Tejun Heo
[not found] ` <1370306679-13129-4-git-send-email-tj-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2013-06-04 13:18 ` Michal Hocko
[not found] ` <20130604131843.GF31242-2MMpYkNvuYDjFM9bn6wA6Q@public.gmane.org>
2013-06-04 20:50 ` Tejun Heo
2013-06-04 21:28 ` Michal Hocko
2013-06-04 21:55 ` Tejun Heo
2013-06-05 7:30 ` Michal Hocko
2013-06-05 8:20 ` Tejun Heo
2013-06-05 8:36 ` Michal Hocko
2013-06-05 8:44 ` Tejun Heo
2013-06-05 8:55 ` Michal Hocko
2013-06-05 9:03 ` Tejun Heo
[not found] ` <20130605082023.GG7303-9pTldWuhBndy/B6EtB590w@public.gmane.org>
2013-06-05 14:39 ` Johannes Weiner
[not found] ` <20130605143949.GQ15576-druUgvl0LCNAfugRpC6u6w@public.gmane.org>
2013-06-05 14:50 ` Johannes Weiner
2013-06-05 17:22 ` Tejun Heo [this message]
[not found] ` <20130605172212.GA10693-9pTldWuhBndy/B6EtB590w@public.gmane.org>
2013-06-05 19:45 ` Johannes Weiner
[not found] ` <20130605194552.GI15721-druUgvl0LCNAfugRpC6u6w@public.gmane.org>
2013-06-05 20:06 ` Tejun Heo
2013-06-05 21:17 ` Johannes Weiner
2013-06-05 22:20 ` Tejun Heo
[not found] ` <20130605222021.GL10693-9pTldWuhBndy/B6EtB590w@public.gmane.org>
2013-06-05 22:27 ` Tejun Heo
2013-06-06 11:50 ` Michal Hocko
2013-06-07 0:52 ` Tejun Heo
[not found] ` <20130607005242.GB16160-Gd/HAXX7CRxy/B6EtB590w@public.gmane.org>
2013-06-07 7:37 ` Michal Hocko
2013-06-07 23:25 ` Tejun Heo
[not found] ` <20130607232557.GL14781-9pTldWuhBndy/B6EtB590w@public.gmane.org>
2013-06-10 8:02 ` Michal Hocko
2013-06-10 19:54 ` Tejun Heo
2013-06-10 20:48 ` Michal Hocko
[not found] ` <20130610204801.GA21003-2MMpYkNvuYDjFM9bn6wA6Q@public.gmane.org>
2013-06-10 23:13 ` Tejun Heo
2013-06-11 7:27 ` Michal Hocko
2013-06-11 7:44 ` Tejun Heo
[not found] ` <20130611074404.GE22530-9pTldWuhBndy/B6EtB590w@public.gmane.org>
2013-06-11 7:55 ` Michal Hocko
2013-06-11 8:00 ` Tejun Heo
2013-06-05 14:56 ` Michal Hocko
2013-06-04 21:40 ` Johannes Weiner
[not found] ` <20130604214050.GP15576-druUgvl0LCNAfugRpC6u6w@public.gmane.org>
2013-06-04 21:49 ` 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=20130605172212.GA10693@mtj.dyndns.org \
--to=tj-dgejt+ai2ygdnm+yrofe0a@public.gmane.org \
--cc=bsingharora-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
--cc=cgroups-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=hannes-druUgvl0LCNAfugRpC6u6w@public.gmane.org \
--cc=linux-mm-Bw31MaZKKs3YtjvyW6yDsg@public.gmane.org \
--cc=lizefan-hv44wF8Li93QT0dZR+AlfA@public.gmane.org \
--cc=mhocko-AlSwsSmVLrQ@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;
as well as URLs for NNTP newsgroup(s).