lkml.org 
[lkml]   [2003]   [Jan]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRE: [PATCH] (2/3) Initial load balancing
Date
From


> -----Original Message-----
> From: Zwane Mwaikambo [mailto:zwane@holomorphy.com]
> Sent: Friday, January 17, 2003 10:42 AM
> To: Pallipadi, Venkatesh
> Cc: Martin J. Bligh; Linus Torvalds; linux-kernel
> Subject: RE: [PATCH] (2/3) Initial load balancing
>
>
> On Fri, 17 Jan 2003, Pallipadi, Venkatesh wrote:
>
> > > +{
> > > + unsigned long old_mask;
> > > +
> > > + old_mask = p->cpus_allowed;
> > > + if (!(old_mask & (1UL << dest_cpu)))
> > > + return;
> > > + /* force the process onto the specified CPU */
> > > + set_cpus_allowed(p, 1UL << dest_cpu);
> > > +
> > > + /* restore the cpus allowed mask */
> > > + set_cpus_allowed(p, old_mask);
> > > +}
> >
> > It may be better to add a _note_ to this function saying
> that it is not
> > supposed to be called by multiple callers at the same time.
> As of now,
> > as it is called at exec time only, I think it is safe. But,
> if it get used at other
> > places, (or called once+preempt) we may have situations
> where we may loose the cpus_allowed mask
> > or miss some sched_migrate_task(). I am looking at, what if
> some sched_migrate_task()
> > or user set_affinity gets initiated in between two
> set_cpus_allowed in
> > this routine.
>
> Shouldn't there be a get_task_struct there?
>
> Zwane

Yes. A get_task_struct() and put_task_struct() there will make the whole

stuff in there lock-protected and should get rid of the issues I was
mentioning.

Thanks,
-Venkatesh
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:32    [W:0.047 / U:0.284 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site