some questions/oddities regarding "exclusive" wait queues

Valdis.Kletnieks at vt.edu Valdis.Kletnieks at vt.edu
Fri Jun 21 19:34:57 EDT 2013


On Fri, 21 Jun 2013 17:54:04 -0400, "Robert P. J. Day" said:

>  * The core wakeup function. Non-exclusive wakeups (nr_exclusive == 0) just
>  * wake everything up. If it's an exclusive wakeup (nr_exclusive == small +ve
>  * number) then we wake all the non-exclusive tasks and one exclusive task.

Right.  Clear as mud. ;)

>         list_for_each_entry_safe(curr, next, &q->task_list, task_list) {
>                 unsigned flags = curr->flags;
>
>                 if (curr->func(curr, mode, wake_flags, key) &&
>                                 (flags & WQ_FLAG_EXCLUSIVE) && !--nr_exclusive)
>                         break;
>         }

Oh, gotta love this tricky C. When do we actually hit the 'break;'? :)

>   first, the comment above that function seems wrong -- that routine
> will not simply wake "one exclusive task", it will wake "int
> nr_exclusive" exclusive tasks, will it not?

Hand-emulating with 'nr_exclusive == 3' indicates that in fact you're right.
Does anybody actually call this with a value other than 1?




-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 865 bytes
Desc: not available
Url : http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20130621/e7976c4e/attachment.bin 


More information about the Kernelnewbies mailing list