lkml.org 
[lkml]   [2015]   [Apr]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
SubjectRe: [PATCH v10 3/4] cgroups: allow a cgroup subsystem to reject a fork
From
Hey,

>> +#define CGROUP_PREFORK_COUNT 0
>> +
>> static inline int cgroup_init_early(void) { return 0; }
>> static inline int cgroup_init(void) { return 0; }
>> static inline void cgroup_fork(struct task_struct *p) {}
>> -static inline void cgroup_post_fork(struct task_struct *p) {}
>> +static inline int cgroup_can_fork(struct task_struct *p,
>> + void *s[CGROUP_PREFORK_COUNT])
>> +{
>> + return 0;
>> +}
>
> Style consistency?

It's because it wraps. I can move it to be something like:

static inline int cgroup_can_fork(struct task_struct *p,
void *s[CGROUP_PREFORK_COUNT])
{ return 0; }

If you like.

>> @@ -2078,6 +2084,18 @@ static void cgroup_task_migrate(struct cgroup *old_cgrp,
>> list_move_tail(&tsk->cg_list, &new_cset->mg_tasks);
>>
>> /*
>> + * We detach from the old_cset subsystems here. We must do this
>> + * before we drop the refcount for old_cset, in order to make sure
>> + * that nobody frees it underneath us.
>> + */
>> + for_each_e_css(css, i, old_cgrp) {
>> + struct cgroup_subsys_state *old_css = old_cset->subsys[i];
>> +
>> + if (old_css->ss->detach)
>> + old_css->ss->detach(old_css, tsk);
>> + }
>
> I don't get this. What can ->detach do that ->can_attach cannot?

->detach signifies that a task is being migrated away from a cgroup.
On second thought, we could just use task_css() on each task in the
tset to figure out what the cgroup the task is being migrated away
from is and just uncharge that inside ->can_attach.

On the same point, are all the tasks in a tset passed to ->can_attach
guaranteed to have the same css? Or do I have to uncharge each one
individually?

--
Aleksa Sarai (cyphar)
www.cyphar.com

\
 
 \ /
  Last update: 2015-04-24 16:21    [W:0.237 / U:1.008 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site