linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Glauber Costa <glommer@parallels.com>
To: linux-mm@kvack.org
Cc: cgroups@vger.kernel.org, kamezawa.hiroyu@jp.fujitsu.com,
	Michal Hocko <mhocko@suse.cz>,
	Johannes Weiner <hannes@cmpxchg.org>,
	Greg Thelen <gthelen@google.com>,
	Frederic Weisbecker <fweisbec@gmail.com>
Subject: [PATCH 0/2] Avoiding expensive reference counting in charge page path
Date: Tue, 14 Aug 2012 14:58:31 +0400	[thread overview]
Message-ID: <1344941913-15075-1-git-send-email-glommer@parallels.com> (raw)

Hi,

In my last submission for the kmem controller for memcg, Kame noted that the
way we use to guarantee that the memcg will still be around while there are
charges is quite expensive: we issue mem_cgroup_get() in every charge, that is
countered by mem_cgroup_put() in every uncharge.

I am trying an alternate way through the two patches that follow. The idea is to
only call mem_cgroup_get() when the first charge happens. We'll use a bit in the
kmem_accounted bitmap for that: we have plenty.

We allow the allocations to continue paying only the cost of a likely branch
over a simple test after that. We also note through another bit the destruction
of that group. When charges get down to 0 after destruction, we then proceed
to release the reference.

I am sending those two patches separately so they get reviewed on their own.
If nobody opposes, I'll add them ontop of the current kmem patches.

Thanks.

Glauber Costa (2):
  return amount of charges after res_counter_uncharge
  Avoid doing a get/put pair in every kmemcg charge

 Documentation/cgroups/resource_counter.txt |  7 ++--
 include/linux/res_counter.h                | 12 ++++---
 kernel/res_counter.c                       | 20 +++++++----
 mm/memcontrol.c                            | 57 ++++++++++++++++++++++++++----
 4 files changed, 74 insertions(+), 22 deletions(-)

-- 
1.7.11.2

--
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:[~2012-08-14 11:02 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-14 10:58 Glauber Costa [this message]
2012-08-14 10:58 ` [PATCH 1/2] return amount of charges after res_counter_uncharge Glauber Costa
2012-08-14 10:58 ` [PATCH 2/2] Avoid doing a get/put pair in every kmemcg charge Glauber Costa

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=1344941913-15075-1-git-send-email-glommer@parallels.com \
    --to=glommer@parallels.com \
    --cc=cgroups@vger.kernel.org \
    --cc=fweisbec@gmail.com \
    --cc=gthelen@google.com \
    --cc=hannes@cmpxchg.org \
    --cc=kamezawa.hiroyu@jp.fujitsu.com \
    --cc=linux-mm@kvack.org \
    --cc=mhocko@suse.cz \
    /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