[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1345463458.23018.37.camel@twins>
Date: Mon, 20 Aug 2012 13:50:58 +0200
From: Peter Zijlstra <peterz@...radead.org>
To: Oleg Nesterov <oleg@...hat.com>
Cc: Dave Jones <davej@...hat.com>,
Linux Kernel <linux-kernel@...r.kernel.org>,
Thomas Gleixner <tglx@...utronix.de>,
rostedt <rostedt@...dmis.org>, dhowells <dhowells@...hat.com>,
Al Viro <viro@...iv.linux.org.uk>
Subject: Re: lockdep trace from posix timers
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 majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists