Hi,

On 28/06/19 14:45, Peter Zijlstra wrote:
> On Fri, Jun 28, 2019 at 10:06:15AM +0200, Juri Lelli wrote:
> > @@ -2154,7 +2154,7 @@ static int cpuset_can_attach(struct cgroup_taskset 
> > *tset)
> >     cpuset_attach_old_cs = task_cs(cgroup_taskset_first(tset, &css));
> >     cs = css_cs(css);
> >  
> > -   mutex_lock(&cpuset_mutex);
> > +   percpu_down_read(&cpuset_rwsem);
> >  
> >     /* allow moving tasks into an empty cpuset if on default hierarchy */
> >     ret = -ENOSPC;
> > @@ -2178,7 +2178,7 @@ static int cpuset_can_attach(struct cgroup_taskset 
> > *tset)
> >     cs->attach_in_progress++;
> >     ret = 0;
> >  out_unlock:
> > -   mutex_unlock(&cpuset_mutex);
> > +   percpu_up_read(&cpuset_rwsem);
> >     return ret;
> >  }
> >  
> > @@ -2188,9 +2188,9 @@ static void cpuset_cancel_attach(struct 
> > cgroup_taskset *tset)
> >  
> >     cgroup_taskset_first(tset, &css);
> >  
> > -   mutex_lock(&cpuset_mutex);
> > +   percpu_down_read(&cpuset_rwsem);
> >     css_cs(css)->attach_in_progress--;
> > -   mutex_unlock(&cpuset_mutex);
> > +   percpu_up_read(&cpuset_rwsem);
> >  }
> 
> These are the only percpu_down_read()s introduced in this patch; are we
> sure this is correct? Specifically, what serializes
> ->attach_in_progress?

No, I think it's wrong, sorry. I'll change to the write variant in next
version.

Thanks,

Juri

Reply via email to