Re: Considerations on sched APIs under RT patch

From: Thomas Gleixner
Date: Tue Apr 27 2010 - 09:19:18 EST


On Tue, 20 Apr 2010, Primiano Tucci wrote:

> Hi Peter,
> thank you for your reply.
>
> On Tue, Apr 20, 2010 at 11:20 AM, Peter Zijlstra <peterz@xxxxxxxxxxxxx> wrote:
> > On Mon, 2010-04-19 at 22:48 +0200, Primiano Tucci wrote:
> >
> >> Yesterday days I found a strange behavior of the scheduler API's using
> >> the RT patch, in particular the pthread_setaffinity_np (that stands on
> >> sched_setaffinity).
> >
> >> I think the main problem is that sched_setaffinity makes use of a
> >> rwlock, but rwlocks are pre-emptible with the RT patch.
> >
> > It does? where?
> >
> > sys_sched_setaffinity()
> >  sched_setaffinity()
> >    set_cpus_allowed_ptr()
>
>
> I see
>
> long sched_setaffinity(pid_t pid, const struct cpumask *in_mask) {
> cpumask_var_t cpus_allowed, new_mask;
> struct task_struct *p;
> int retval;
>
> get_online_cpus();
> --> read_lock(&tasklist_lock);

You must be looking at some older version of -rt. The current
2.6.33-rt series does not take tasklist_lock in sched_setaffinity().

Thanks,

tglx