linux-acpi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Alex Naidis <alex.naidis@linux.com>
To: Tejun Heo <tj@kernel.org>
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 22:32:52 +0200	[thread overview]
Message-ID: <CACuw83qxQ2_b2wOwCe1_PhLn=CR9pf4p6ckC_RWhAJs0L3eVpA@mail.gmail.com> (raw)
In-Reply-To: <20170524202143.GN24798@htj.duckdns.org>

Hello,

2017-05-24 22:21 GMT+02:00 Tejun Heo <tj@kernel.org>:
> 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.
>
what I thought is that might be a good idea to catch at least
some cases where the work is already running. It is obviously wrong
to rely on the corectness of the return value.

Do you agree here or would you suggest another
alternative here?

> Rafael, Len, can you please explain why work_busy() test is there?
>
> Thanks.
>
> --
> tejun

Thank you!
Alex

      reply	other threads:[~2017-05-24 20:33 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         ` [PATCH] workqueue: Implement delayed_work_busy() Tejun Heo
2017-05-24 20:32           ` Alex Naidis [this message]

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='CACuw83qxQ2_b2wOwCe1_PhLn=CR9pf4p6ckC_RWhAJs0L3eVpA@mail.gmail.com' \
    --to=alex.naidis@linux.com \
    --cc=lenb@kernel.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rjw@rjwysocki.net \
    --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;
as well as URLs for NNTP newsgroup(s).