lkml.org 
[lkml]   [2014]   [Mar]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH RFC] sched: introduce add_wait_queue_exclusive_head
On Wed, Mar 19, 2014 at 05:49:07PM +0100, Oleg Nesterov wrote:
> +static void add_wait_queue_flag(wait_queue_head_t *q, wait_queue_t *wait)
> +{
> + struct list_head *head = &q->task_list;
> + wait_queue_t *excl;
> +
> + if (wait->flags & WQ_FLAG_EXCLUSIVE) {
> + if (wait->flags & WQ_FLAG_EXCLUSIVE_HEAD) {
> + list_for_each_entry(excl, head, task_list)
> + if (excl->flags & WQ_FLAG_EXCLUSIVE) {
> + head = &excl->task_list;
> + break;
> + }

I prefer an extra pair of { } here, but the main concern would be the
cost of that iteration.

> + }
> + /* turn list_add() below into list_add_tail() */
> + head = head->prev;
> + }
> +
> + list_add(&wait->task_list, head);
> +}

Other than that, yes something like that would do I suppose.


\
 
 \ /
  Last update: 2014-03-19 18:41    [W:0.057 / U:0.676 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site