Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1649935

Re: [PATCH] workqueue: Implement delayed_work_busy()

From Alex Naidis <alex.naidis@linux.com>
Newsgroups linux.kernel
Subject Re: [PATCH] workqueue: Implement delayed_work_busy()
Date 2017-05-24 22:40 +0200
Message-ID <tKLex-72S-11@gated-at.bofh.it> (permalink)
References (1 earlier) <tKGeT-40h-27@gated-at.bofh.it> <tKKLw-6SV-3@gated-at.bofh.it> <tKKLw-6SV-13@gated-at.bofh.it> <tKKVc-6Ww-35@gated-at.bofh.it> <tKL4S-6ZL-11@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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

Back to linux.kernel | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

[PATCH] workqueue: Implement delayed_work_busy() Alex Naidis <alex.naidis@linux.com> - 2017-05-24 01:40 +0200
  Re: [PATCH] workqueue: Implement delayed_work_busy() Tejun Heo <tj@kernel.org> - 2017-05-24 17:20 +0200
    Fwd: [PATCH] workqueue: Implement delayed_work_busy() Alex Naidis <alex.naidis@linux.com> - 2017-05-24 22:10 +0200
    Re: [PATCH] workqueue: Implement delayed_work_busy() Tejun Heo <tj@kernel.org> - 2017-05-24 22:10 +0200
      Re: [PATCH] workqueue: Implement delayed_work_busy() Alex Naidis <alex.naidis@linux.com> - 2017-05-24 22:20 +0200
        Re: [PATCH] workqueue: Implement delayed_work_busy() Tejun Heo <tj@kernel.org> - 2017-05-24 22:30 +0200
          Re: [PATCH] workqueue: Implement delayed_work_busy() Alex Naidis <alex.naidis@linux.com> - 2017-05-24 22:40 +0200

csiph-web