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, 10 May 2023 08:33:14 -1000
From:   Tejun Heo <tj@...nel.org>
To:     Johannes Berg <johannes@...solutions.net>
Cc:     linux-kernel@...r.kernel.org, linux-wireless@...r.kernel.org,
        Lai Jiangshan <jiangshanlai@...il.com>,
        Johannes Berg <johannes.berg@...el.com>
Subject: Re: [RFC PATCH 1/4] workqueue: support pausing ordered workqueues

Hello,

This looks great to me in general.

On Wed, May 10, 2023 at 06:04:25PM +0200, Johannes Berg wrote:
> diff --git a/kernel/workqueue.c b/kernel/workqueue.c
> index b8b541caed48..418d99ff8325 100644
> --- a/kernel/workqueue.c
> +++ b/kernel/workqueue.c
> @@ -3863,10 +3863,16 @@ static void pwq_adjust_max_active(struct pool_workqueue *pwq)
>  	struct workqueue_struct *wq = pwq->wq;
>  	bool freezable = wq->flags & WQ_FREEZABLE;
>  	unsigned long flags;
> +	int new_max_active;
>  
> -	/* for @wq->saved_max_active */
> +	/* for @wq->saved_max_active and @wq->flags */
>  	lockdep_assert_held(&wq->mutex);
>  
> +	if (wq->flags & __WQ_PAUSED)
> +		new_max_active = 0;
> +	else
> +		new_max_active = wq->saved_max_active;

Nothing is using new_max_active and I think we can probably combine this
with the freezing test.

> +void __workqueue_pause_resume(struct workqueue_struct *wq, bool pause)
> +{
> +	struct pool_workqueue *pwq;
> +
> +	mutex_lock(&wq->mutex);
> +	if (pause)
> +		wq->flags |= __WQ_PAUSED;
> +	else
> +		wq->flags &= ~__WQ_PAUSED;
> +
> +	for_each_pwq(pwq, wq)
> +		pwq_adjust_max_active(pwq);
> +	mutex_unlock(&wq->mutex);
> +
> +	if (pause)
> +		flush_workqueue(wq);
> +}
> +EXPORT_SYMBOL_GPL(__workqueue_pause_resume);

I'd just make pause and resume separate functions. The sharing ratio doesn't
seem that high.

Thanks.

-- 
tejun

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ