Re: [(RT RFC) PATCH v2 3/9] rearrange rt_spin_lock sleep

From: Gregory Haskins
Date: Mon Feb 25 2008 - 19:52:48 EST


>>> On Mon, Feb 25, 2008 at 4:54 PM, in message
<20080225215454.GF2659@xxxxxxxxxx>, Pavel Machek <pavel@xxxxxx> wrote:
> Hi!
>
>> @@ -720,7 +728,8 @@ rt_spin_lock_slowlock(struct rt_mutex *lock)
>> * saved_state accordingly. If we did not get a real wakeup
>> * then we return with the saved state.
>> */
>> - saved_state = xchg(&current->state, TASK_UNINTERRUPTIBLE);
>> + saved_state = current->state;
>> + smp_mb();
>>
>> for (;;) {
>> unsigned long saved_flags;
>
> Please document what the barrier is good for.

Yeah, I think you are right that this isn't needed. I think that is a relic from back when I was debugging some other problems. Let me wrap my head around the implications of removing it, and either remove it or document appropriately.

>
> Plus, you are replacing atomic operation with nonatomic; is that ok?

Yeah, I think so. We are substituting a write with a read, and word reads are always atomic anyway IIUC (or is that only true on certain architectures)? Note that we are moving the atomic-write to be done later in the update_current() calls.

-Greg



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