lkml.org 
[lkml]   [2011]   [Feb]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 4/4] workqueue: Remove now superfluous cancel_delayed_work() calls
Hello, Peter.

On Thu, Feb 03, 2011 at 03:09:44PM +0100, Peter Zijlstra wrote:
> Since queue_delayed_work() can now deal with existing timers, we don't
> need to explicitly call cancel_delayed_work() anymore.

This is nice but there's small complication with the way
queue_delayed_work() behaves. If a delayed work item is already
pending, another queue_delayed_work() doesn't modify the delay whether
the new delay is longer or shorter than the current one. The previous
patch doesn't really change the behavior as the whole thing is gated
with WORK_STRUCT_PENDING_BIT.

So, cancel_delayed_work() followed by queue_delayed_work() schedules
the work to be executed at the specified time regardless of the
current pending state while queue_delayed_work() takes effect iff
currently the work item is not pending.

The current behavior is weird and it often is easier to use explicit
timer + work item if the timer needs to be modified, but it has been
that way from the beginning so I don't think changing it would be a
good idea. We can introduce a new interface (mod_delayed_work()
maybe) for this tho.

Thanks.

--
tejun


\
 
 \ /
  Last update: 2011-02-03 17:23    [W:0.066 / U:0.488 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site