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: Wed, 27 Dec 2023 05:05:49 +0900
From: Tejun Heo <tj@...nel.org>
To: Lai Jiangshan <jiangshanlai@...il.com>
Cc: linux-kernel@...r.kernel.org, Naohiro.Aota@....com,
	kernel-team@...a.com
Subject: Re: [PATCH 01/10] workqueue: Move pwq->max_active to wq->max_active

Hello,

On Tue, Dec 26, 2023 at 05:13:40PM +0800, Lai Jiangshan wrote:
> On Wed, Dec 20, 2023 at 3:25 PM Tejun Heo <tj@...nel.org> wrote:
> 
> > +static void wq_adjust_max_active(struct workqueue_struct *wq)
> > +{
> > +       struct pool_workqueue *pwq;
> > +
> > +       lockdep_assert_held(&wq->mutex);
> > +
> > +       if ((wq->flags & WQ_FREEZABLE) && workqueue_freezing) {
> > +               wq->max_active = 0;
> > +               return;
> > +       }
> > +
> > +       if (wq->max_active == wq->saved_max_active)
> > +               return;
> > +
> > +       wq->max_active = wq->saved_max_active;
> > +
> 
> If a work item gets queued now, it will get scheduled earlier than a
> previous queued one which is still in the inactive list.

Is that a problem tho? There's no execution order guarantee except for
ordered workqueues which is not affected by this. In a later change, we
switch to list of pending pwqs instead of work items and the issue ordering
is lost anyway. This isn't a significant departure from previous behaviors
either given that there has never been ordering across pwq boundaries.

> To solve it, I recommend adding wq->queue_max_active which will be
> updated after the following code and used only when queue_work().
> But it requires round-robin through PWQs the second time after
> wq->queue_max_active is updated to catch the new inactivated items.

I'm reluctant to add complications for this given that it's not a real
problem to begin with and the operation is pretty cold.

> Or just keep pwq->max_active and will be
> updated after activating inactivated items and used only when queue_work().

This probably is simpler but would make things more complicated. I'm not
sure it's worth it.

Thanks.

-- 
tejun

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ