Re: [Lse-tech] [RFC][PATCH 05/10] Task watchers v2 Register cpuset task watcher

Matt Helsley
2006-09-29T07:52:18Z

On Thu, 2006-09-28 at 19:31 -0700, Paul Jackson wrote:
> Matt wrote:
>
> > - cpuset_fork(p);
> > #ifdef CONFIG_NUMA
> > p->mempolicy = mpol_copy(p->mempolicy);
> > if (IS_ERR(p->mempolicy)) {
> > retval = PTR_ERR(p->mempolicy);
> > p->mempolicy = NULL;
> > - goto bad_fork_cleanup_cpuset;
> > + goto bad_fork_cleanup_delays_binfmt;
> > }
> > mpol_fix_fork_child_flag(p);
> > #endif
> > #ifdef CONFIG_TRACE_IRQFLAGS
> > p->irq_events = 0;
> > @@ -1280,13 +1278,11 @@ bad_fork_cleanup_files:
> > bad_fork_cleanup_security:
> > security_task_free(p);
> > bad_fork_cleanup_policy:
> > #ifdef CONFIG_NUMA
> > mpol_free(p->mempolicy);
> > -bad_fork_cleanup_cpuset:
> > #endif
> > - cpuset_exit(p);
> > bad_fork_cleanup_delays_binfmt:
>
>
> The above code, before your change, had the affect that if mpol_copy()
> failed, then the cpusets that were just setup by the cpuset_fork()
> call were undone by a cpuset_exit() call.
>
> >From what I can tell, after your change, this is no longer done,
> and a failed mpol_copy will leave cpusets in an incorrect state.
>
> Am I missing something?
>

If you look in the first patch there's a corresponding
notify_task_watchers(WATCH_TASK_FREE, tsk) below when we get a failure
from INIT. That in turn calls cpuset_exit() because a cpuset_exit()
because a hunk of this patch marks it for execution whenever a task is
freed.

Cheers,
-Matt Helsley