* Re: [PATCH] workqueue: Implement delayed_work_busy()
[not found] ` <CACuw83qcNAX1RNr=G6cfGeLqTKL-rtDLpK60o65BB50dLPMOzA@mail.gmail.com>
@ 2017-05-24 20:21 ` Tejun Heo
2017-05-24 20:32 ` Alex Naidis
0 siblings, 1 reply; 2+ messages in thread
From: Tejun Heo @ 2017-05-24 20:21 UTC (permalink / raw)
To: Alex Naidis; +Cc: linux-kernel, Rafael J. Wysocki, Len Brown, linux-acpi
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
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] workqueue: Implement delayed_work_busy()
2017-05-24 20:21 ` [PATCH] workqueue: Implement delayed_work_busy() Tejun Heo
@ 2017-05-24 20:32 ` Alex Naidis
0 siblings, 0 replies; 2+ messages in thread
From: Alex Naidis @ 2017-05-24 20:32 UTC (permalink / raw)
To: Tejun Heo; +Cc: linux-kernel, Rafael J. Wysocki, Len Brown, linux-acpi
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
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-05-24 20:33 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[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 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).