On Thu, Oct 8, 2009 at 7:30 PM, Denis Kirjanov <[email protected]> wrote:
> Hello dear all!
>
> Suppose, we have the following pseudo code:
>
> spin_lock(&some_lock);
> some_func();
> spin_unlock(&some_lock);
>
> some_fun()
> {
> .....
> wake_up_interruptibe_sync(&wait_queue);
> ....
> }
> Is this correct behavior or not?
>
> This is a call chain:
> wake_up_interruptible_sync ---> wake_up_sync ---> wake_up_common(...,
> sync=1, ...) ---> ... ---> try_to_wake_up(..., sync=1)
> try_to_wake_up invokes resched_task().
> As a result, we invoke one thread, while other holds the lock.
>
> Tell me please, my assumption is correct?
>
> --
> Regards,
> Denis
>
I dont think try_to_wake_up call invokes any rescheduling function.
Also, __wake_up_sync is already calling __wake_up_common with spin
lock held, so i think it is safe what you are trying to do. Please
correct me if I am wrong at any point.
[snip]
void
4349__wake_up_sync(wait_queue_head_t *q, unsigned int mode, int nr_exclusive)
4350{
4351 unsigned long flags;
4352 int sync = 1;
4353
4354 if (unlikely(!q))
4355 return;
4356
4357 if (unlikely(!nr_exclusive))
4358 sync = 0;
4359
4360 spin_lock_irqsave(&q->lock, flags);
4361 __wake_up_common(q, mode, nr_exclusive, sync, NULL);
4362 spin_unlock_irqrestore(&q->lock, flags);
4363}
[\snip]
-Vinit
--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to [email protected]
Please read the FAQ at http://kernelnewbies.org/FAQ