[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20141015151836.GG23547@dhcp22.suse.cz>
Date: Wed, 15 Oct 2014 17:18:36 +0200
From: Michal Hocko <mhocko@...e.cz>
To: Johannes Weiner <hannes@...xchg.org>
Cc: Andrew Morton <akpm@...ux-foundation.org>,
Vladimir Davydov <vdavydov@...allels.com>, linux-mm@...ck.org,
cgroups@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [patch 2/5] mm: memcontrol: take a css reference for each
charged page
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@...xchg.org>
> Reviewed-by: Vladimir Davydov <vdavydov@...allels.com>
Acked-by: Michal Hocko <mhocko@...e.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...
> stock->nr_pages = 0;
> }
> stock->cached = NULL;
> @@ -2513,6 +2514,7 @@ bypass:
> return -EINTR;
>
> done_restock:
> + css_get_many(&memcg->css, batch);
> if (batch > nr_pages)
> refill_stock(memcg, batch - nr_pages);
> done:
[...]
--
Michal Hocko
SUSE Labs
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists