lkml.org 
[lkml]   [2008]   [Jun]   [12]   [last100]   RSS Feed
Views: [more markup]  [less markup]  [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH 5/5] futex: fix miss ordered wakeups
FromPeter Zijlstra <>
DateThu, 12 Jun 2008 08:07:05 +0200
On Wed, 2008-06-11 at 13:49 -0700, Daniel Walker wrote:
> plain text document attachment (blocked_on-futex.patch)

I thought everybody and his dog didn't care for this?

> +void futex_adjust_waiters(struct task_struct *p)
> +{
> +

Seemingly extra whitespace ^

> +	if (p->blocked_on) {
> +		struct futex_hash_bucket *hb;
> +		struct futex_q *q, *next;
> +		union futex_key key;
> +
> +		spin_lock_irq(&p->pi_lock);
> +		if (p->blocked_on && p->blocked_on->lock_type == FUTEX_WAITER) {
> +			key = *p->blocked_on->futex_blocked_on;
> +			spin_unlock_irq(&p->pi_lock);
> +		} else {
> +			spin_unlock_irq(&p->pi_lock);
> +			return;
> +		}
> +
> +		hb = hash_futex(&key);
> +		spin_lock(&hb->lock);
> +		plist_for_each_entry_safe(q, next, &hb->chain, list) {
> +			if (match_futex(&q->key, &key) && q->task == p) {
> +				int prio = min(p->normal_prio, MAX_RT_PRIO);
> +				plist_del(&q->list, &hb->chain);
> +				plist_node_init(&q->list, prio);
> +				plist_add(&q->list, &hb->chain);
> +				break;
> +			}
> +		}
> +		spin_unlock(&hb->lock);
> +	}
> +}

Also, if you write it like:

  if (!p->blocked_on)
    return
  do_other_stuff

you loose one nesting level - which imho looks better.



\
 
 \ /
  Last update: 2008-06-12 08:09    [from the cache]
©2003-2008