[Devel] Re: [RFC][PATCH] introduce task cgroup (#task restrictioon for prevent fork bomb by cgroup)

KAMEZAWA Hiroyuki kamezawa.hiroyu at jp.fujitsu.com
Wed Jun 4 22:13:18 PDT 2008


On Thu, 05 Jun 2008 13:43:06 +0900
KOSAKI Motohiro <kosaki.motohiro at jp.fujitsu.com> wrote:
> +static int task_cgroup_max_tasks_write(struct cgroup *cgrp,
> +				       struct cftype *cftype,
> +				       s64 max_tasks)
> +{
> +	struct task_cgroup *taskcg;
> +
> +	if ((max_tasks > INT_MAX) ||
> +	    (max_tasks < INT_MIN))
> +		return -EINVAL;

should be (max_tasks > INT_MAX) || (max_tasks < -1)) ?

> +
> +	taskcg = task_cgroup_from_cgrp(cgrp);
> +
> +	spin_lock(&taskcg->lock);
> +	if (max_tasks < taskcg->nr_tasks)
> +		return -EBUSY;
> +	taskcg->max_tasks = max_tasks;
> +	spin_unlock(&taskcg->lock);
This will cause dead lock.

And it seems this doesn't handle "attach failure".

It will be helpful Documentation somewhere.

Thanks,
-Kame

_______________________________________________
Containers mailing list
Containers at lists.linux-foundation.org
https://lists.linux-foundation.org/mailman/listinfo/containers




More information about the Devel mailing list