Re: [PATCH 1/2] cgroup: get a ref to source csses when migrating

2015-08-25 Thread Tejun Heo
Hello, Aleksa. On Tue, Aug 25, 2015 at 12:00:54PM +1000, Aleksa Sarai wrote: > You also mentioned that depending on the css_set's ref being bumped to > protect the contained csses is "sort of implementation detail. It can > be implemented in different ways." Which made me think that depending >

Re: [PATCH 1/2] cgroup: get a ref to source csses when migrating

2015-08-25 Thread Tejun Heo
Hello, Aleksa. On Tue, Aug 25, 2015 at 12:00:54PM +1000, Aleksa Sarai wrote: You also mentioned that depending on the css_set's ref being bumped to protect the contained csses is sort of implementation detail. It can be implemented in different ways. Which made me think that depending on

Re: [PATCH 1/2] cgroup: get a ref to source csses when migrating

2015-08-24 Thread Aleksa Sarai
> Have you verified that the scenario you're describing can actually > happen? AFAICS, cgroup_migrate_add_src() already does the pinning. Hmmm. Looking at it, group_migrate_add_src() does grab a ref on the css_set which contains the css, and the comments mention that grabbing a ref on the

Re: [PATCH 1/2] cgroup: get a ref to source csses when migrating

2015-08-24 Thread Tejun Heo
On Sun, Aug 23, 2015 at 11:10:31PM +1000, Aleksa Sarai wrote: > Grab a ref to each source css being migrated from, otherwise it's > possible for the refcount to reach zero between ->can_attach() and > ->cancel_attach(). This means that operations on the task's old css > (such as container_of(...))

Re: [PATCH 1/2] cgroup: get a ref to source csses when migrating

2015-08-24 Thread Tejun Heo
On Sun, Aug 23, 2015 at 11:10:31PM +1000, Aleksa Sarai wrote: Grab a ref to each source css being migrated from, otherwise it's possible for the refcount to reach zero between -can_attach() and -cancel_attach(). This means that operations on the task's old css (such as container_of(...))

Re: [PATCH 1/2] cgroup: get a ref to source csses when migrating

2015-08-24 Thread Aleksa Sarai
Have you verified that the scenario you're describing can actually happen? AFAICS, cgroup_migrate_add_src() already does the pinning. Hmmm. Looking at it, group_migrate_add_src() does grab a ref on the css_set which contains the css, and the comments mention that grabbing a ref on the css_set

[PATCH 1/2] cgroup: get a ref to source csses when migrating

2015-08-23 Thread Aleksa Sarai
Grab a ref to each source css being migrated from, otherwise it's possible for the refcount to reach zero between ->can_attach() and ->cancel_attach(). This means that operations on the task's old css (such as container_of(...)) become unsafe, as we may be operating on a different css.

[PATCH 1/2] cgroup: get a ref to source csses when migrating

2015-08-23 Thread Aleksa Sarai
Grab a ref to each source css being migrated from, otherwise it's possible for the refcount to reach zero between -can_attach() and -cancel_attach(). This means that operations on the task's old css (such as container_of(...)) become unsafe, as we may be operating on a different css.