lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Sun, 10 Mar 2013 05:38:44 -0700
From:	Tejun Heo <tj@...nel.org>
To:	Lai Jiangshan <laijs@...fujitsu.com>
Cc:	linux-kernel@...r.kernel.org, axboe@...nel.dk, jmoyer@...hat.com,
	zab@...hat.com
Subject: Re: [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
--
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

Powered by Openwall GNU/*/Linux Powered by OpenVZ