Re: [patch 4/7] rtmutex: unify state manipulation

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, 19 Dec 2008, Steven Rostedt wrote:
> > +	} while (cmpxchg(&current->state, state, block_state) != state);
> 
> Doesn't this break archs that do not have cmpxchg?

We can use xchg. The waiter is protected against the RUNNING_MUTEX
state change via the mutex->lock. It's just some overcautioness when I
started to fix this.

> There might be another way. We could just use your TASK_RUNNING_MUTEX or 
> trick for both mutexes and spinlocks.

The mechanisms should be the same for everything now.
 
> > -	if (mtx)
> > -		set_current_state(TASK_RUNNING);
> > -	else {
> > -		state = xchg(&current->state, saved_state);
> > -		if (unlikely(state == TASK_RUNNING))
> > -			current->state = TASK_RUNNING;
> > -	}
> > +	rt_restore_current_state(saved_state);
> 
> This is a bug. A mutex always leaves in the TASK_RUNNING state.
 
Duh, yes. So this should be:

     rt_restore_current_state(!mtx ? saved_state : TASK_RUNNING);

> What about having the locking spinlocks and mutexes be almost identical. 
> Like the rwlocks are (rwlocks and rwsems share the same code). We can use 
> the RT_MUTEX_RUNNING trick for both. The only difference is that a mutex 
> will always leave in the TASK_RUNNING state.

Good point.

Thanks,

	tglx
--
To unsubscribe from this list: send the line "unsubscribe linux-rt-users" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [RT Stable]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux