linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] cgroup hook after successful create
@ 2012-10-31 12:29 Glauber Costa
  2012-10-31 12:29 ` [PATCH 1/2] generalize post_clone into post_create Glauber Costa
  2012-10-31 12:29 ` [PATCH 2/2] allow post_create to fail Glauber Costa
  0 siblings, 2 replies; 3+ messages in thread
From: Glauber Costa @ 2012-10-31 12:29 UTC (permalink / raw)
  To: cgroups; +Cc: Tejun Heo, linux-mm, linux-kernel, Peter Zijlstra

Hi,

cgroups that use css_id only have this number assigned after ->create()
returns.  This means it is not possible to use this number for anything during
cgroup initialization.

There are situations in which it may come handy: in the kmemcg-slab patchset,
for instance, each memcg that has a limit on kernel memory will use its css_id
as an index in an array of per-memcg kmem_caches. This array increases in size
(in bulks, of course) as the maximum possible index grows, so we need to be
aware of that early.

This could be achieved with a hook called after ->create(). Such a hook exists:
this is ->post_clone(). However, this is called only for cgroups that set the
clone_children flag. I believe a more general hook is useful, and the following
two patches generalize post_clone() into a hook that is always called after
create.

As I mentioned, I intend to do memory allocations from that hook so it can fail
(in patch 2, for simplicity).

I consider a general hook acceptable and useful, and is the simplest solution to
the problem I face. Let me know what you guys think of it.

Glauber Costa (2):
  generalize post_clone into post_create
  allow post_create to fail

 Documentation/cgroups/cgroups.txt | 13 +++++++------
 include/linux/cgroup.h            |  7 ++++++-
 kernel/cgroup.c                   | 12 +++++-------
 kernel/cpuset.c                   | 19 +++++++++++--------
 4 files changed, 29 insertions(+), 22 deletions(-)

-- 
1.7.11.7

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2012-10-31 12:29 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-10-31 12:29 [PATCH 0/2] cgroup hook after successful create Glauber Costa
2012-10-31 12:29 ` [PATCH 1/2] generalize post_clone into post_create Glauber Costa
2012-10-31 12:29 ` [PATCH 2/2] allow post_create to fail Glauber Costa

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox