All of lore.kernel.org
 help / color / mirror / Atom feed
From: Glauber Costa <glommer@parallels.com>
To: <cgroups@vger.kernel.org>
Cc: <netdev@vger.kernel.org>, Li Zefan <lizefan@huawei.com>,
	Tejun Heo <tj@kernel.org>, <kamezawa.hiroyu@jp.fujitsu.com>,
	<linux-mm@kvack.org>, <devel@openvz.org>
Subject: [PATCH v3 0/2] fix problem with static_branch() for sock memcg
Date: Thu, 26 Apr 2012 18:24:21 -0300	[thread overview]
Message-ID: <1335475463-25167-1-git-send-email-glommer@parallels.com> (raw)

Hi,

While trying to fulfill's Christoph's request for using static_branches
to do part of the role of number_of_cpusets in the cpuset cgroup, I took
a much more extensive look at the cpuset code (Thanks Christoph).

I started to feel that removing the cgroup_lock() from cpuset's
destroy is not as safe as I first imagined. At the very best, is not safe
enough to be bundled in a bugfix and deserves its own analysis.

I started then to consider another approach. While I voiced many times
that I would not like to do deferred updates for the static_branches, doing
that during destroy time would be perfectly acceptable IMHO (creation is
another story). In a summary, we are effectively calling the static_branch
updates only when the last reference to the memcg is gone. And that is
already asynchronous by nature, and we cope well with that.

In memcg, it turns out that we already do deferred freeing of the memcg
structure depending on the size of struct mem_cgroup.

My proposal is to always do that, and then we get a worker more or less
for free. Patch 2 is basically the same I had posted before, with minor
adaptations, plus the addition of a commentary explaining a race as
requested by Kame.

Let me know if this is acceptable.

Thanks

Glauber Costa (2):
  Always free struct memcg through schedule_work()
  decrement static keys on real destroy time

 include/net/sock.h        |    9 ++++++
 mm/memcontrol.c           |   54 ++++++++++++++++++++++++++--------
 net/ipv4/tcp_memcontrol.c |   70 ++++++++++++++++++++++++++++++++++++++++----
 3 files changed, 113 insertions(+), 20 deletions(-)

-- 
1.7.7.6

--
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/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

WARNING: multiple messages have this Message-ID (diff)
From: Glauber Costa <glommer@parallels.com>
To: cgroups@vger.kernel.org
Cc: netdev@vger.kernel.org, Li Zefan <lizefan@huawei.com>,
	Tejun Heo <tj@kernel.org>,
	kamezawa.hiroyu@jp.fujitsu.com, linux-mm@kvack.org,
	devel@openvz.org
Subject: [PATCH v3 0/2] fix problem with static_branch() for sock memcg
Date: Thu, 26 Apr 2012 18:24:21 -0300	[thread overview]
Message-ID: <1335475463-25167-1-git-send-email-glommer@parallels.com> (raw)

Hi,

While trying to fulfill's Christoph's request for using static_branches
to do part of the role of number_of_cpusets in the cpuset cgroup, I took
a much more extensive look at the cpuset code (Thanks Christoph).

I started to feel that removing the cgroup_lock() from cpuset's
destroy is not as safe as I first imagined. At the very best, is not safe
enough to be bundled in a bugfix and deserves its own analysis.

I started then to consider another approach. While I voiced many times
that I would not like to do deferred updates for the static_branches, doing
that during destroy time would be perfectly acceptable IMHO (creation is
another story). In a summary, we are effectively calling the static_branch
updates only when the last reference to the memcg is gone. And that is
already asynchronous by nature, and we cope well with that.

In memcg, it turns out that we already do deferred freeing of the memcg
structure depending on the size of struct mem_cgroup.

My proposal is to always do that, and then we get a worker more or less
for free. Patch 2 is basically the same I had posted before, with minor
adaptations, plus the addition of a commentary explaining a race as
requested by Kame.

Let me know if this is acceptable.

Thanks

Glauber Costa (2):
  Always free struct memcg through schedule_work()
  decrement static keys on real destroy time

 include/net/sock.h        |    9 ++++++
 mm/memcontrol.c           |   54 ++++++++++++++++++++++++++--------
 net/ipv4/tcp_memcontrol.c |   70 ++++++++++++++++++++++++++++++++++++++++----
 3 files changed, 113 insertions(+), 20 deletions(-)

-- 
1.7.7.6

--
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/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

             reply	other threads:[~2012-04-26 21:24 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-26 21:24 Glauber Costa [this message]
2012-04-26 21:24 ` [PATCH v3 0/2] fix problem with static_branch() for sock memcg Glauber Costa
2012-04-26 21:24 ` [PATCH v3 1/2] Always free struct memcg through schedule_work() Glauber Costa
2012-04-26 21:24   ` Glauber Costa
2012-04-26 21:24   ` Glauber Costa
2012-04-26 21:24 ` [PATCH v3 2/2] decrement static keys on real destroy time Glauber Costa
2012-04-26 21:24   ` Glauber Costa
2012-04-26 21:24   ` Glauber Costa
     [not found]   ` <1335475463-25167-3-git-send-email-glommer-bzQdu9zFT3WakBO8gow8eQ@public.gmane.org>
2012-04-26 21:39     ` Tejun Heo
2012-04-26 21:39       ` Tejun Heo
2012-04-26 21:58       ` Glauber Costa
2012-04-26 21:58         ` Glauber Costa
2012-04-26 22:13         ` Tejun Heo
2012-04-26 22:17           ` Glauber Costa
2012-04-26 22:17             ` Glauber Costa
     [not found]             ` <4F99C980.3030801-bzQdu9zFT3WakBO8gow8eQ@public.gmane.org>
2012-04-26 22:22               ` Tejun Heo
2012-04-26 22:22                 ` Tejun Heo
2012-04-26 22:28                 ` Glauber Costa
2012-04-26 22:28                   ` Glauber Costa
     [not found]                   ` <4F99CC17.4080006-bzQdu9zFT3WakBO8gow8eQ@public.gmane.org>
2012-04-26 22:32                     ` Tejun Heo
2012-04-26 22:32                       ` Tejun Heo

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=1335475463-25167-1-git-send-email-glommer@parallels.com \
    --to=glommer@parallels.com \
    --cc=cgroups@vger.kernel.org \
    --cc=devel@openvz.org \
    --cc=kamezawa.hiroyu@jp.fujitsu.com \
    --cc=linux-mm@kvack.org \
    --cc=lizefan@huawei.com \
    --cc=netdev@vger.kernel.org \
    --cc=tj@kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.