linux-acpi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Tejun Heo <tj@kernel.org>
To: Alex Naidis <alex.naidis@linux.com>
Cc: linux-kernel@vger.kernel.org,
	"Rafael J. Wysocki" <rjw@rjwysocki.net>,
	Len Brown <lenb@kernel.org>,
	linux-acpi@vger.kernel.org
Subject: Re: [PATCH] workqueue: Implement delayed_work_busy()
Date: Wed, 24 May 2017 16:21:43 -0400	[thread overview]
Message-ID: <20170524202143.GN24798@htj.duckdns.org> (raw)
In-Reply-To: <CACuw83qcNAX1RNr=G6cfGeLqTKL-rtDLpK60o65BB50dLPMOzA@mail.gmail.com>

Hello,

cc'ing ACPI folks.

On Wed, May 24, 2017 at 10:16:02PM +0200, Alex Naidis wrote:
> 2017-05-24 22:01 GMT+02:00 Tejun Heo <tj@kernel.org>:
> > Hello, Alex.
> >
> > On Wed, May 24, 2017 at 09:58:19PM +0200, Alex Naidis wrote:
> >> Yeah, I agree, it is wrong to rely on work_busy() providing correct data.
> >> However sometimes it is useful to have an indicator like this to at least
> >> catch some cases where requeuing work would be obsolete.
> >> This applies for delayed work too.
> >
> > Can you elaborage on "requeueing work would be obsolate" a bit?
> Sure.
> The case that I mean is represented well by the usage of work_busy here:
> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/acpi/bus.c#n534
> It checks work_busy() before requeuing the work, since in some cases
> it is obsolete
> to requeue the work if it is already pending or running.

So, there is no point in testing whether a work item is pending before
queeing it.  It's completely spurious.  The only part which makes
sense is if it doesn't want to queue a work item if it's already
running (but note that this isn't synchronized properly) for some
reason, but given that it can race with workqueue operation and
spuriously return false when the work item just started running, it
can't be for correctness.

Rafael, Len, can you please explain why work_busy() test is there?

Thanks.

-- 
tejun

       reply	other threads:[~2017-05-24 20:21 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1495582493-10069-1-git-send-email-alex.naidis@linux.com>
     [not found] ` <20170524151154.GD24798@htj.duckdns.org>
     [not found]   ` <CACuw83r65iSCQdV1WVR=wQqw0voJ_98HmsRF9XaAdeGtQ_daGQ@mail.gmail.com>
     [not found]     ` <20170524200141.GM24798@htj.duckdns.org>
     [not found]       ` <CACuw83qcNAX1RNr=G6cfGeLqTKL-rtDLpK60o65BB50dLPMOzA@mail.gmail.com>
2017-05-24 20:21         ` Tejun Heo [this message]
2017-05-24 20:32           ` [PATCH] workqueue: Implement delayed_work_busy() Alex Naidis

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=20170524202143.GN24798@htj.duckdns.org \
    --to=tj@kernel.org \
    --cc=alex.naidis@linux.com \
    --cc=lenb@kernel.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rjw@rjwysocki.net \
    /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;
as well as URLs for NNTP newsgroup(s).