From: Michal Hocko <mhocko@suse.cz>
To: Vladimir Davydov <vdavydov@parallels.com>
Cc: akpm@linux-foundation.org, hannes@cmpxchg.org, glommer@gmail.com,
linux-kernel@vger.kernel.org, linux-mm@kvack.org,
devel@openvz.org, Christoph Lameter <cl@linux-foundation.org>,
Pekka Enberg <penberg@kernel.org>
Subject: Re: [PATCH -mm 1/4] sl[au]b: do not charge large allocations to memcg
Date: Wed, 26 Mar 2014 14:53:20 -0700 [thread overview]
Message-ID: <20140326215320.GA22656@dhcp22.suse.cz> (raw)
In-Reply-To: <5a5b09d4cb9a15fc120b4bec8be168630a3b43c2.1395846845.git.vdavydov@parallels.com>
On Wed 26-03-14 19:28:04, Vladimir Davydov wrote:
> We don't track any random page allocation, so we shouldn't track kmalloc
> that falls back to the page allocator.
Why did we do that in the first place? d79923fad95b (sl[au]b: allocate
objects from memcg cache) didn't tell me much.
How is memcg_kmem_skip_account removal related?
> Signed-off-by: Vladimir Davydov <vdavydov@parallels.com>
> Cc: Johannes Weiner <hannes@cmpxchg.org>
> Cc: Michal Hocko <mhocko@suse.cz>
> Cc: Glauber Costa <glommer@gmail.com>
> Cc: Christoph Lameter <cl@linux-foundation.org>
> Cc: Pekka Enberg <penberg@kernel.org>
> ---
> include/linux/slab.h | 2 +-
> mm/memcontrol.c | 27 +--------------------------
> mm/slub.c | 4 ++--
> 3 files changed, 4 insertions(+), 29 deletions(-)
>
> diff --git a/include/linux/slab.h b/include/linux/slab.h
> index 3dd389aa91c7..8a928ff71d93 100644
> --- a/include/linux/slab.h
> +++ b/include/linux/slab.h
> @@ -363,7 +363,7 @@ kmalloc_order(size_t size, gfp_t flags, unsigned int order)
> {
> void *ret;
>
> - flags |= (__GFP_COMP | __GFP_KMEMCG);
> + flags |= __GFP_COMP;
> ret = (void *) __get_free_pages(flags, order);
> kmemleak_alloc(ret, size, 1, flags);
> return ret;
> diff --git a/mm/memcontrol.c b/mm/memcontrol.c
> index b4b6aef562fa..81a162d01d4d 100644
> --- a/mm/memcontrol.c
> +++ b/mm/memcontrol.c
> @@ -3528,35 +3528,10 @@ __memcg_kmem_newpage_charge(gfp_t gfp, struct mem_cgroup **_memcg, int order)
>
> *_memcg = NULL;
>
> - /*
> - * Disabling accounting is only relevant for some specific memcg
> - * internal allocations. Therefore we would initially not have such
> - * check here, since direct calls to the page allocator that are marked
> - * with GFP_KMEMCG only happen outside memcg core. We are mostly
> - * concerned with cache allocations, and by having this test at
> - * memcg_kmem_get_cache, we are already able to relay the allocation to
> - * the root cache and bypass the memcg cache altogether.
> - *
> - * There is one exception, though: the SLUB allocator does not create
> - * large order caches, but rather service large kmallocs directly from
> - * the page allocator. Therefore, the following sequence when backed by
> - * the SLUB allocator:
> - *
> - * memcg_stop_kmem_account();
> - * kmalloc(<large_number>)
> - * memcg_resume_kmem_account();
> - *
> - * would effectively ignore the fact that we should skip accounting,
> - * since it will drive us directly to this function without passing
> - * through the cache selector memcg_kmem_get_cache. Such large
> - * allocations are extremely rare but can happen, for instance, for the
> - * cache arrays. We bring this test here.
> - */
> - if (!current->mm || current->memcg_kmem_skip_account)
> + if (!current->mm)
> return true;
>
> memcg = get_mem_cgroup_from_mm(current->mm);
> -
> if (!memcg_can_account_kmem(memcg)) {
> css_put(&memcg->css);
> return true;
> diff --git a/mm/slub.c b/mm/slub.c
> index 5e234f1f8853..c2e58a787443 100644
> --- a/mm/slub.c
> +++ b/mm/slub.c
> @@ -3325,7 +3325,7 @@ static void *kmalloc_large_node(size_t size, gfp_t flags, int node)
> struct page *page;
> void *ptr = NULL;
>
> - flags |= __GFP_COMP | __GFP_NOTRACK | __GFP_KMEMCG;
> + flags |= __GFP_COMP | __GFP_NOTRACK;
> page = alloc_pages_node(node, flags, get_order(size));
> if (page)
> ptr = page_address(page);
> @@ -3395,7 +3395,7 @@ void kfree(const void *x)
> if (unlikely(!PageSlab(page))) {
> BUG_ON(!PageCompound(page));
> kfree_hook(x);
> - __free_memcg_kmem_pages(page, compound_order(page));
> + __free_pages(page, compound_order(page));
> return;
> }
> slab_free(page->slab_cache, page, object, _RET_IP_);
> --
> 1.7.10.4
>
--
Michal Hocko
SUSE Labs
--
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-03-26 21:54 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-03-26 15:28 [PATCH -mm 0/4] kmemcg: get rid of __GFP_KMEMCG Vladimir Davydov
2014-03-26 15:28 ` [PATCH -mm 1/4] sl[au]b: do not charge large allocations to memcg Vladimir Davydov
2014-03-26 21:53 ` Michal Hocko [this message]
2014-03-27 7:34 ` Vladimir Davydov
2014-03-27 20:40 ` Michal Hocko
2014-03-27 4:31 ` Greg Thelen
2014-03-27 7:37 ` Vladimir Davydov
2014-03-27 20:42 ` Greg Thelen
2014-03-28 7:56 ` Vladimir Davydov
2014-03-27 20:43 ` Michal Hocko
2014-03-28 7:58 ` Vladimir Davydov
2014-03-26 15:28 ` [PATCH -mm 2/4] sl[au]b: charge slabs to memcg explicitly Vladimir Davydov
2014-03-26 21:58 ` Michal Hocko
2014-03-27 7:38 ` Vladimir Davydov
2014-03-27 20:38 ` Michal Hocko
2014-03-26 15:28 ` [PATCH -mm 3/4] fork: charge threadinfo " Vladimir Davydov
2014-03-26 22:00 ` Michal Hocko
2014-03-27 7:39 ` Vladimir Davydov
2014-03-26 15:28 ` [PATCH -mm 4/4] mm: kill __GFP_KMEMCG 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=20140326215320.GA22656@dhcp22.suse.cz \
--to=mhocko@suse.cz \
--cc=akpm@linux-foundation.org \
--cc=cl@linux-foundation.org \
--cc=devel@openvz.org \
--cc=glommer@gmail.com \
--cc=hannes@cmpxchg.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=penberg@kernel.org \
--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).