On Mon, 2012-08-20 at 13:44 +0200, Peter Zijlstra wrote:
>  int
> +task_work_add(struct task_struct *task, struct callback_head *work, bool 
> notify)
>  {
> +       struct callback_head **head = &task->task_works;
> +       struct callback_head *entry, *old_entry;
> +
> +       entry = &head;

My compiler just alerted me that: 

        entry = *head; 

works a lot better..

> +       for (;;) {
> +               if (entry == &dead)
> +                       return -ESRCH;
> +
> +               old_entry = entry;
> +               work->next = entry;
> +               entry = cmpxchg(head, old_entry, work);
> +               if (entry == old_entry)
> +                       break;
> +       }
>  
>         /* test_and_set_bit() implies mb(), see tracehook_notify_resume(). */
>         if (notify)
>                 set_notify_resume(task);
> +
>         return 0;
>  } 
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to