lkml.org 
[lkml]   [2012]   [Aug]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: lockdep trace from posix timers
On 08/20, Peter Zijlstra wrote:
>
> +static void __task_work_run(struct callback_head *tail)
> {
> - struct task_struct *task = current;
> - struct callback_head *p, *q;
> -
> - while (1) {
> - raw_spin_lock_irq(&task->pi_lock);
> - p = task->task_works;
> - task->task_works = NULL;
> - raw_spin_unlock_irq(&task->pi_lock);
> -
> - if (unlikely(!p))
> - return;
> -
> - q = p->next; /* head */
> - p->next = NULL; /* cut it */
> - while (q) {
> - p = q->next;
> - q->func(q);
> - q = p;
> + struct callback_head **head = &current->task_works;
> +
> + do {
> + struct callback_head *work = xchg(head, NULL);
> + while (work) {
> + struct callback_head *next = ACCESS_ONCE(work->next);
> +
> + WARN_ON_ONCE(work == &dead);
> +
> + work->func(work);
> + work = next;
> }
> - }
> + } while (cmpxchg(head, NULL, tail) != NULL);

Yes, we can add the explicit argument to __task_work_run(), but it can
check PF_EXITING instead, this looks simpler to me.

Note also your patch breaks fifo, but this is fixable.

Oleg.



\
 
 \ /
  Last update: 2012-08-20 17:41    [W:0.757 / U:0.596 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site