lkml.org 
[lkml]   [2013]   [Mar]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 12/31] workqueue: update synchronization rules on workqueue->pwqs
Hello, Lai.

On Sun, Mar 10, 2013 at 06:09:28PM +0800, Lai Jiangshan wrote:
> > #define for_each_pwq(pwq, wq) \
> > - list_for_each_entry((pwq), &(wq)->pwqs, pwqs_node)
> > + list_for_each_entry_rcu((pwq), &(wq)->pwqs, pwqs_node) \
> > + if (({ assert_rcu_or_wq_lock(); true; }))
>
> Aware this:
>
> if (somecondition)
> for_each_pwq(pwq, wq)
> one_statement;q
> else
> xxxxx;
>
>
> for_each_pwq() will eat the else.

Yeah, but that will also generate a compiler warning.

> To avoid this, you can use:
>
> #define for_each_pwq(pwq, wq) \
> list_for_each_entry_rcu((pwq), &(wq)->pwqs, pwqs_node) \
> if (({ assert_rcu_or_wq_lock(); false; })) { } \
> else
>
>
> The same for for_each_pool() in later patch.

Ooh, yeah, that's better. Will do that.

Thanks.

--
tejun


\
 
 \ /
  Last update: 2013-03-10 14:21    [W:0.167 / U:0.052 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site