From: Johannes Weiner <hannes@cmpxchg.org>
To: Michal Hocko <mhocko@suse.cz>
Cc: Andrew Morton <akpm@linux-foundation.org>,
Vladimir Davydov <vdavydov@parallels.com>,
linux-mm@kvack.org, cgroups@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [patch 2/5] mm: memcontrol: take a css reference for each charged page
Date: Wed, 15 Oct 2014 14:44:10 -0400 [thread overview]
Message-ID: <20141015184410.GB6442@phnom.home.cmpxchg.org> (raw)
In-Reply-To: <20141015151836.GG23547@dhcp22.suse.cz>
On Wed, Oct 15, 2014 at 05:18:36PM +0200, Michal Hocko wrote:
> On Tue 14-10-14 12:20:34, Johannes Weiner wrote:
> > Charges currently pin the css indirectly by playing tricks during
> > css_offline(): user pages stall the offlining process until all of
> > them have been reparented, whereas kmemcg acquires a keep-alive
> > reference if outstanding kernel pages are detected at that point.
> >
> > In preparation for removing all this complexity, make the pinning
> > explicit and acquire a css references for every charged page.
> >
> > Signed-off-by: Johannes Weiner <hannes@cmpxchg.org>
> > Reviewed-by: Vladimir Davydov <vdavydov@parallels.com>
>
> Acked-by: Michal Hocko <mhocko@suse.cz>
>
> > ---
> > include/linux/cgroup.h | 26 +++++++++++++++++++++++
> > include/linux/percpu-refcount.h | 47 +++++++++++++++++++++++++++++++++--------
> > mm/memcontrol.c | 21 ++++++++++++++----
> > 3 files changed, 81 insertions(+), 13 deletions(-)
> >
> [...]
> > diff --git a/mm/memcontrol.c b/mm/memcontrol.c
> > index 67dabe8b0aa6..a3feead6be15 100644
> > --- a/mm/memcontrol.c
> > +++ b/mm/memcontrol.c
> > @@ -2256,6 +2256,7 @@ static void drain_stock(struct memcg_stock_pcp *stock)
> > page_counter_uncharge(&old->memory, stock->nr_pages);
> > if (do_swap_account)
> > page_counter_uncharge(&old->memsw, stock->nr_pages);
> > + css_put_many(&old->css, stock->nr_pages);
>
> I have suggested to add a comment about pairing css_get here because the
> corresponding refill_stock doesn't take any reference which might be
> little bit confusing. Nothing earth shattering of course...
Ah, but this isn't the counter-part to refill_stock(), consume_stock()
is. The references are taken for the charges, and those two functions
do not change the account. css get/put pair exactly like page counter
charge/uncharge.
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
next prev parent reply other threads:[~2014-10-15 18:44 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-10-14 16:20 [patch 0/5] mm: memcontrol: eliminate charge reparenting v2 Johannes Weiner
2014-10-14 16:20 ` [patch 1/5] mm: memcontrol: convert reclaim iterator to simple css refcounting Johannes Weiner
2014-10-15 15:02 ` Michal Hocko
2014-10-15 18:31 ` Johannes Weiner
2014-10-14 16:20 ` [patch 2/5] mm: memcontrol: take a css reference for each charged page Johannes Weiner
2014-10-15 15:18 ` Michal Hocko
2014-10-15 18:44 ` Johannes Weiner [this message]
2014-10-14 16:20 ` [patch 3/5] mm: memcontrol: remove obsolete kmemcg pinning tricks Johannes Weiner
2014-10-15 15:21 ` Michal Hocko
2014-10-14 16:20 ` [patch 4/5] mm: memcontrol: continue cache reclaim from offlined groups Johannes Weiner
2014-10-15 15:25 ` Michal Hocko
2014-10-17 3:02 ` Johannes Weiner
2014-10-17 4:42 ` Andrew Morton
2014-10-17 8:40 ` Vladimir Davydov
2014-10-17 14:00 ` Michal Hocko
2014-10-17 15:20 ` Vladimir Davydov
2014-10-14 16:20 ` [patch 5/5] mm: memcontrol: remove synchroneous stock draining code Johannes Weiner
2014-10-15 15:28 ` Michal Hocko
2014-10-17 8:48 ` Vladimir Davydov
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=20141015184410.GB6442@phnom.home.cmpxchg.org \
--to=hannes@cmpxchg.org \
--cc=akpm@linux-foundation.org \
--cc=cgroups@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mhocko@suse.cz \
--cc=vdavydov@parallels.com \
/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).