linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: Vladimir Davydov <vdavydov@parallels.com>
Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org,
	devel@openvz.org, Greg Thelen <gthelen@google.com>,
	Johannes Weiner <hannes@cmpxchg.org>,
	Michal Hocko <mhocko@suse.cz>, Glauber Costa <glommer@gmail.com>,
	Christoph Lameter <cl@linux-foundation.org>,
	Pekka Enberg <penberg@kernel.org>
Subject: Re: [PATCH -mm v2.2] mm: get rid of __GFP_KMEMCG
Date: Thu, 10 Apr 2014 16:38:31 -0700	[thread overview]
Message-ID: <20140410163831.c76596b0f8d0bef39a42c63f@linux-foundation.org> (raw)
In-Reply-To: <1396537559-17453-1-git-send-email-vdavydov@parallels.com>

On Thu, 3 Apr 2014 19:05:59 +0400 Vladimir Davydov <vdavydov@parallels.com> wrote:

> Currently to allocate a page that should be charged to kmemcg (e.g.
> threadinfo), we pass __GFP_KMEMCG flag to the page allocator. The page
> allocated is then to be freed by free_memcg_kmem_pages. Apart from
> looking asymmetrical, this also requires intrusion to the general
> allocation path. So let's introduce separate functions that will
> alloc/free pages charged to kmemcg.
> 
> The new functions are called alloc_kmem_pages and free_kmem_pages. They
> should be used when the caller actually would like to use kmalloc, but
> has to fall back to the page allocator for the allocation is large. They
> only differ from alloc_pages and free_pages in that besides allocating
> or freeing pages they also charge them to the kmem resource counter of
> the current memory cgroup.
> 
> ...
>
> +void *kmalloc_order(size_t size, gfp_t flags, unsigned int order)
> +{
> +	void *ret;
> +	struct page *page;
> +
> +	flags |= __GFP_COMP;
> +	page = alloc_kmem_pages(flags, order);
> +	ret = page ? page_address(page) : NULL;
> +	kmemleak_alloc(ret, size, 1, flags);
> +	return ret;
> +}

While we're in there it wouldn't hurt to document this: why it exists,
what it does, etc.  And why it sets __GFP_COMP.

--
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>

  reply	other threads:[~2014-04-10 23:38 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-01  7:38 [PATCH -mm v2 0/2] cleanup kmemcg charging (was: "kmemcg: get rid of __GFP_KMEMCG") Vladimir Davydov
2014-04-01  7:38 ` [PATCH -mm v2 1/2] sl[au]b: charge slabs to kmemcg explicitly Vladimir Davydov
2014-04-02  0:49   ` Greg Thelen
2014-04-01  7:38 ` [PATCH -mm v2 2/2] mm: get rid of __GFP_KMEMCG Vladimir Davydov
2014-04-02  0:48   ` Greg Thelen
2014-04-02  6:11     ` Vladimir Davydov
2014-04-02  6:16   ` [PATCH -mm v2.1] " Vladimir Davydov
2014-04-02 21:25     ` Greg Thelen
2014-04-03 15:04       ` Vladimir Davydov
2014-04-03 15:05     ` [PATCH -mm v2.2] " Vladimir Davydov
2014-04-10 23:38       ` Andrew Morton [this message]
2014-04-11 12:52         ` [PATCH -mm] slab: document kmalloc_order Vladimir Davydov
2014-04-11 15:57           ` Christoph Lameter
2014-04-11 17:24             ` Vladimir Davydov
2014-04-11 16:07       ` [PATCH -mm v2.2] mm: get rid of __GFP_KMEMCG Christoph Lameter
2014-04-11 17:33         ` 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=20140410163831.c76596b0f8d0bef39a42c63f@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=cl@linux-foundation.org \
    --cc=devel@openvz.org \
    --cc=glommer@gmail.com \
    --cc=gthelen@google.com \
    --cc=hannes@cmpxchg.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mhocko@suse.cz \
    --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).