mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Johannes Berg <johannes@sipsolutions.net>
To: Tejun Heo <tj@kernel.org>
Cc: linux-kernel@vger.kernel.org, linux-wireless@vger.kernel.org,
	Lai Jiangshan <jiangshanlai@gmail.com>
Subject: Re: [RFC PATCH 1/4] workqueue: support pausing ordered workqueues
Date: Wed, 10 May 2023 20:40:33 +0200	[thread overview]
Message-ID: <f8bfe27a4eed789f97143246fb7d1c0756c2cd35.camel@sipsolutions.net> (raw)
In-Reply-To: <ZFvjahvVPqWH0XBR@slm.duckdns.org>

Hi,

> > -	/* 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.

Err, yikes. Of course this was meant to be used in the remainder of the
code, oops.

Regarding the freezing test, yeah, maybe. It seemed harder to follow,
but I'll take another look.

> > +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.
> 

Yeah, I wasn't really sure about that either. I keep thinking the
EXPORT_SYMBOL_GPL() itself is really big, but I'm not even sure about
that, and it's probably not a great reason anyway.

johannes

  reply	other threads:[~2023-05-10 18:40 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-10 16:04 [RFC PATCH 0/4] wifi locking simplification start Johannes Berg
2023-05-10 16:04 ` [RFC PATCH 1/4] workqueue: support pausing ordered workqueues Johannes Berg
2023-05-10 18:33   ` Tejun Heo
2023-05-10 18:40     ` Johannes Berg [this message]
2023-05-10 16:04 ` [RFC PATCH 2/4] workqueue: support holding a mutex for each work Johannes Berg
2023-05-10 18:34   ` Tejun Heo
2023-05-10 19:16     ` Johannes Berg
2023-05-10 19:28       ` Tejun Heo
2023-05-10 16:04 ` [RFC PATCH 3/4] wifi: cfg80211: add a workqueue with special semantics Johannes Berg
2023-05-10 16:04 ` [RFC PATCH 4/4] wifi: cfg80211: move scan done work to cfg80211 workqueue Johannes Berg

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=f8bfe27a4eed789f97143246fb7d1c0756c2cd35.camel@sipsolutions.net \
    --to=johannes@sipsolutions.net \
    --cc=jiangshanlai@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=tj@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®