Re: [PATCH 2/8] cgroup: kill CSS_REMOVED

2012-11-04 Thread Li Zefan
On 2012/11/1 3:44, Tejun Heo wrote: > CSS_REMOVED is one of the several contortions which were necessary to > support css reference draining on cgroup removal. All css->refcnts > which need draining should be deactivated and verified to equal zero > atomically w.r.t. css_tryget(). If any one

Re: [PATCH 2/8] cgroup: kill CSS_REMOVED

2012-11-04 Thread Li Zefan
On 2012/11/1 3:44, Tejun Heo wrote: CSS_REMOVED is one of the several contortions which were necessary to support css reference draining on cgroup removal. All css-refcnts which need draining should be deactivated and verified to equal zero atomically w.r.t. css_tryget(). If any one isn't

Re: [PATCH 2/8] cgroup: kill CSS_REMOVED

2012-11-02 Thread Kamezawa Hiroyuki
(2012/11/01 4:44), Tejun Heo wrote: > CSS_REMOVED is one of the several contortions which were necessary to > support css reference draining on cgroup removal. All css->refcnts > which need draining should be deactivated and verified to equal zero > atomically w.r.t. css_tryget(). If any one

Re: [PATCH 2/8] cgroup: kill CSS_REMOVED

2012-11-02 Thread Kamezawa Hiroyuki
(2012/10/31 13:22), Tejun Heo wrote: > CSS_REMOVED is one of the several contortions which were necessary to > support css reference draining on cgroup removal. All css->refcnts > which need draining should be deactivated and verified to equal zero > atomically w.r.t. css_tryget(). If any one

Re: [PATCH 2/8] cgroup: kill CSS_REMOVED

2012-11-02 Thread Kamezawa Hiroyuki
(2012/10/31 13:22), Tejun Heo wrote: CSS_REMOVED is one of the several contortions which were necessary to support css reference draining on cgroup removal. All css-refcnts which need draining should be deactivated and verified to equal zero atomically w.r.t. css_tryget(). If any one isn't

Re: [PATCH 2/8] cgroup: kill CSS_REMOVED

2012-11-02 Thread Kamezawa Hiroyuki
(2012/11/01 4:44), Tejun Heo wrote: CSS_REMOVED is one of the several contortions which were necessary to support css reference draining on cgroup removal. All css-refcnts which need draining should be deactivated and verified to equal zero atomically w.r.t. css_tryget(). If any one isn't

[PATCH 2/8] cgroup: kill CSS_REMOVED

2012-10-31 Thread Tejun Heo
CSS_REMOVED is one of the several contortions which were necessary to support css reference draining on cgroup removal. All css->refcnts which need draining should be deactivated and verified to equal zero atomically w.r.t. css_tryget(). If any one isn't zero, all refcnts needed to be

Re: [PATCH 2/8] cgroup: kill CSS_REMOVED

2012-10-31 Thread Tejun Heo
Hey, Michal. On Wed, Oct 31, 2012 at 08:16:02PM +0100, Michal Hocko wrote: > Sure, it cannot detect races but this wasn't the intention of the check. > The more important part is that memcg can outlive css and we want to > catch bugs when we try to charge to an already dead memcg. cgroup will

Re: [PATCH 2/8] cgroup: kill CSS_REMOVED

2012-10-31 Thread Michal Hocko
On Wed 31-10-12 09:57:39, Tejun Heo wrote: > Hey, Michal. > > On Wed, Oct 31, 2012 at 04:39:26PM +0100, Michal Hocko wrote: > > > prepare_to_wait(_rmdir_waitq, , TASK_INTERRUPTIBLE); > > > > > > - local_irq_disable(); > > > - > > > > OK, so the new charges shouldn't come from the IRQ context

[PATCH 2/8] cgroup: kill CSS_REMOVED

2012-10-31 Thread Tejun Heo
CSS_REMOVED is one of the several contortions which were necessary to support css reference draining on cgroup removal. All css->refcnts which need draining should be deactivated and verified to equal zero atomically w.r.t. css_tryget(). If any one isn't zero, all refcnts needed to be

Re: [PATCH 2/8] cgroup: kill CSS_REMOVED

2012-10-31 Thread Tejun Heo
Hello, Glauber. On Wed, Oct 31, 2012 at 09:38:32PM +0400, Glauber Costa wrote: > Because I am allocating an array big enough to hold one entry per memcg. > The natural array index for this, is the css_id. Obviously, I don't want > this array to have 65k entries in size, so I resize it (doubling

Re: [PATCH 2/8] cgroup: kill CSS_REMOVED

2012-10-31 Thread Glauber Costa
On 10/31/2012 09:25 PM, Tejun Heo wrote: > More proper names for these callbacks would be, > > ->allocate() > ->online() > ->offline() > ->free() I support the name change, btw. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a

Re: [PATCH 2/8] cgroup: kill CSS_REMOVED

2012-10-31 Thread Glauber Costa
On 10/31/2012 09:25 PM, Tejun Heo wrote: > Hello, > > On Wed, Oct 31, 2012 at 09:19:51PM +0400, Glauber Costa wrote: >> I don't see post_create failing as a huge problem. The natural >> synchronization point would be "right after post_create" - then you can >> definitely tell that it is online.

Re: [PATCH 2/8] cgroup: kill CSS_REMOVED

2012-10-31 Thread Tejun Heo
Hello, On Wed, Oct 31, 2012 at 09:19:51PM +0400, Glauber Costa wrote: > I don't see post_create failing as a huge problem. The natural > synchronization point would be "right after post_create" - then you can > definitely tell that it is online. Although this can be viewed a bit as > "exposing

Re: [PATCH 2/8] cgroup: kill CSS_REMOVED

2012-10-31 Thread Glauber Costa
On 10/31/2012 09:10 PM, Tejun Heo wrote: > Hello, Glauber. > > On Wed, Oct 31, 2012 at 10:06 AM, Glauber Costa wrote: >> This is not the topic of this thread, but since you brought it: >> If you take a look at the description patch in the patch I sent, the >> problem I outlined is that at create

Re: [PATCH 2/8] cgroup: kill CSS_REMOVED

2012-10-31 Thread Tejun Heo
Hello, Glauber. On Wed, Oct 31, 2012 at 10:06 AM, Glauber Costa wrote: > This is not the topic of this thread, but since you brought it: > If you take a look at the description patch in the patch I sent, the > problem I outlined is that at create time, we don't know anything about > which will

Re: [PATCH 2/8] cgroup: kill CSS_REMOVED

2012-10-31 Thread Glauber Costa
On 10/31/2012 08:57 PM, Tejun Heo wrote: > I have a patch queued to add ->pre_destroy() - different from > Glauber's in that it can't fail, so we'll have > > ->create() > ->post_create() > ->pre_destroy() > ->destroy() > > Where ->create() may fail but

Re: [PATCH 2/8] cgroup: kill CSS_REMOVED

2012-10-31 Thread Tejun Heo
Hey, Michal. On Wed, Oct 31, 2012 at 04:39:26PM +0100, Michal Hocko wrote: > > prepare_to_wait(_rmdir_waitq, , TASK_INTERRUPTIBLE); > > > > - local_irq_disable(); > > - > > OK, so the new charges shouldn't come from the IRQ context so we cannot > race with css_tryget but why did we need

Re: [PATCH 2/8] cgroup: kill CSS_REMOVED

2012-10-31 Thread Michal Hocko
On Tue 30-10-12 21:22:39, Tejun Heo wrote: > CSS_REMOVED is one of the several contortions which were necessary to > support css reference draining on cgroup removal. All css->refcnts > which need draining should be deactivated and verified to equal zero > atomically w.r.t. css_tryget(). If any

Re: [PATCH 2/8] cgroup: kill CSS_REMOVED

2012-10-31 Thread Michal Hocko
On Tue 30-10-12 21:22:39, Tejun Heo wrote: CSS_REMOVED is one of the several contortions which were necessary to support css reference draining on cgroup removal. All css-refcnts which need draining should be deactivated and verified to equal zero atomically w.r.t. css_tryget(). If any one

Re: [PATCH 2/8] cgroup: kill CSS_REMOVED

2012-10-31 Thread Tejun Heo
Hey, Michal. On Wed, Oct 31, 2012 at 04:39:26PM +0100, Michal Hocko wrote: prepare_to_wait(cgroup_rmdir_waitq, wait, TASK_INTERRUPTIBLE); - local_irq_disable(); - OK, so the new charges shouldn't come from the IRQ context so we cannot race with css_tryget but why did we need

Re: [PATCH 2/8] cgroup: kill CSS_REMOVED

2012-10-31 Thread Glauber Costa
On 10/31/2012 08:57 PM, Tejun Heo wrote: I have a patch queued to add -pre_destroy() - different from Glauber's in that it can't fail, so we'll have -create() -post_create() -pre_destroy() -destroy() Where -create() may fail but none other can.

Re: [PATCH 2/8] cgroup: kill CSS_REMOVED

2012-10-31 Thread Tejun Heo
Hello, Glauber. On Wed, Oct 31, 2012 at 10:06 AM, Glauber Costa glom...@parallels.com wrote: This is not the topic of this thread, but since you brought it: If you take a look at the description patch in the patch I sent, the problem I outlined is that at create time, we don't know anything

Re: [PATCH 2/8] cgroup: kill CSS_REMOVED

2012-10-31 Thread Glauber Costa
On 10/31/2012 09:10 PM, Tejun Heo wrote: Hello, Glauber. On Wed, Oct 31, 2012 at 10:06 AM, Glauber Costa glom...@parallels.com wrote: This is not the topic of this thread, but since you brought it: If you take a look at the description patch in the patch I sent, the problem I outlined is

Re: [PATCH 2/8] cgroup: kill CSS_REMOVED

2012-10-31 Thread Tejun Heo
Hello, On Wed, Oct 31, 2012 at 09:19:51PM +0400, Glauber Costa wrote: I don't see post_create failing as a huge problem. The natural synchronization point would be right after post_create - then you can definitely tell that it is online. Although this can be viewed a bit as exposing

Re: [PATCH 2/8] cgroup: kill CSS_REMOVED

2012-10-31 Thread Glauber Costa
On 10/31/2012 09:25 PM, Tejun Heo wrote: Hello, On Wed, Oct 31, 2012 at 09:19:51PM +0400, Glauber Costa wrote: I don't see post_create failing as a huge problem. The natural synchronization point would be right after post_create - then you can definitely tell that it is online. Although

Re: [PATCH 2/8] cgroup: kill CSS_REMOVED

2012-10-31 Thread Glauber Costa
On 10/31/2012 09:25 PM, Tejun Heo wrote: More proper names for these callbacks would be, -allocate() -online() -offline() -free() I support the name change, btw. -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to

Re: [PATCH 2/8] cgroup: kill CSS_REMOVED

2012-10-31 Thread Tejun Heo
Hello, Glauber. On Wed, Oct 31, 2012 at 09:38:32PM +0400, Glauber Costa wrote: Because I am allocating an array big enough to hold one entry per memcg. The natural array index for this, is the css_id. Obviously, I don't want this array to have 65k entries in size, so I resize it (doubling

[PATCH 2/8] cgroup: kill CSS_REMOVED

2012-10-31 Thread Tejun Heo
CSS_REMOVED is one of the several contortions which were necessary to support css reference draining on cgroup removal. All css-refcnts which need draining should be deactivated and verified to equal zero atomically w.r.t. css_tryget(). If any one isn't zero, all refcnts needed to be

Re: [PATCH 2/8] cgroup: kill CSS_REMOVED

2012-10-31 Thread Michal Hocko
On Wed 31-10-12 09:57:39, Tejun Heo wrote: Hey, Michal. On Wed, Oct 31, 2012 at 04:39:26PM +0100, Michal Hocko wrote: prepare_to_wait(cgroup_rmdir_waitq, wait, TASK_INTERRUPTIBLE); - local_irq_disable(); - OK, so the new charges shouldn't come from the IRQ context so we

Re: [PATCH 2/8] cgroup: kill CSS_REMOVED

2012-10-31 Thread Tejun Heo
Hey, Michal. On Wed, Oct 31, 2012 at 08:16:02PM +0100, Michal Hocko wrote: Sure, it cannot detect races but this wasn't the intention of the check. The more important part is that memcg can outlive css and we want to catch bugs when we try to charge to an already dead memcg. cgroup will

[PATCH 2/8] cgroup: kill CSS_REMOVED

2012-10-31 Thread Tejun Heo
CSS_REMOVED is one of the several contortions which were necessary to support css reference draining on cgroup removal. All css-refcnts which need draining should be deactivated and verified to equal zero atomically w.r.t. css_tryget(). If any one isn't zero, all refcnts needed to be

[PATCH 2/8] cgroup: kill CSS_REMOVED

2012-10-30 Thread Tejun Heo
CSS_REMOVED is one of the several contortions which were necessary to support css reference draining on cgroup removal. All css->refcnts which need draining should be deactivated and verified to equal zero atomically w.r.t. css_tryget(). If any one isn't zero, all refcnts needed to be

[PATCH 2/8] cgroup: kill CSS_REMOVED

2012-10-30 Thread Tejun Heo
CSS_REMOVED is one of the several contortions which were necessary to support css reference draining on cgroup removal. All css-refcnts which need draining should be deactivated and verified to equal zero atomically w.r.t. css_tryget(). If any one isn't zero, all refcnts needed to be