lkml.org 
[lkml]   [2012]   [Aug]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    SubjectRe: lockdep trace from posix timers
    From
    Date
    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;
    > }


    \
     
     \ /
      Last update: 2012-08-20 14:22    [W:0.022 / U:63.772 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site