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:	Mon, 19 May 2014 16:15:31 -0400
From:	Tejun Heo <tj@...nel.org>
To:	Frederic Weisbecker <fweisbec@...il.com>
Cc:	LKML <linux-kernel@...r.kernel.org>,
	Lai Jiangshan <laijs@...fujitsu.com>,
	Christoph Lameter <cl@...ux.com>,
	Kevin Hilman <khilman@...aro.org>,
	Mike Galbraith <bitbucket@...ine.de>,
	"Paul E. McKenney" <paulmck@...ux.vnet.ibm.com>,
	Viresh Kumar <viresh.kumar@...aro.org>
Subject: Re: [PATCH 1/5] workqueue: Allow changing attributions of ordered
 workqueues

Hello,

On Sat, May 17, 2014 at 03:41:55PM +0200, Frederic Weisbecker wrote:
> > > -	last_pool = get_work_pool(work);
> > > +	last_pool = wq->flags & __WQ_ORDERED ? NULL : get_work_pool(work);
> > >  	if (last_pool && last_pool != pwq->pool) {
> > >  		struct worker *worker;
> > 
> > I'm not a big fan of the fact that ordered queues need to be handled
> > differently when queueing, but as the code is currently written, this
> > is pretty much necessary to maintain execution order, right?
> >
> > Otherwise, you end up with requeueing work items targeting the pwq it
> > was executing on and new ones targeting the newest one screwing up the
> > ordering.  I think that'd be a lot more important to note in the
> > comment.  This is a correctness measure.  Back-to-back requeueing
> > being affected by this is just a side-effect.
> 
> In the case of ordered workqueues it actually doesn't matter much in
> term of ordering. But it's needed when pwqs are replaced (as it happens
> in apply_workqueue_attrs(). We must make sure works requeueing themselves
> don't always requeue to the old pwq otherwise it will never be able to
> switch and be released. Also the next work items will be queued on the next

But that's the same for other pwqs too.  Back-to-back requeueing will
hold back pwq switching on any workqueue.

> pwq but this one will never be able to run due to the old workqueue still
> being used by the item requeing itself. So we also risk starvation on the
> new workqueue.
> 
> But the ordering itself is actually fine for ordered workqueue. It's actually
> enforced by the fact that only one pwq can run at a time for a given workqueue.

Maybe I'm confused but I don't think it'd be.  Let's say there was an
attribute change with one work item, A, which is performing
back-to-back requeueing and another one, B, which queues itself
intermittently.  If B is queued while A is executing, followed by A
requeueing itself, the expected execution order is A - B - A; however,
without the above exception for ordered workqueues, it'd end up A - A
- B because B will end up on the new pwq while A on the older one and
max_active won't be transferred to the new pwq before it becomes
empty.

> > Just collapse it into the calling function.  This obfuscates more than
> > helps.
> 
> Yeah but the condition is already big. Lets hope the result won't be too ugly.

I didn't mean that the condition should be encoded in the if
conditional.  It's fine to break it out using a separate variable or
whatever.  I just don't think breaking it out to a separate function
is helping anything.

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