1. 11 Oct, 2010 2 commits
    • Tejun Heo's avatar
      workqueue: add and use WQ_MEM_RECLAIM flag · 6370a6ad
      Tejun Heo authored
      Add WQ_MEM_RECLAIM flag which currently maps to WQ_RESCUER, mark
      WQ_RESCUER as internal and replace all external WQ_RESCUER usages to
      WQ_MEM_RECLAIM.
      
      This makes the API users express the intent of the workqueue instead
      of indicating the internal mechanism used to guarantee forward
      progress.  This is also to make it cleaner to add more semantics to
      WQ_MEM_RECLAIM.  For example, if deemed necessary, memory reclaim
      workqueues can be made highpri.
      
      This patch doesn't introduce any functional change.
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      Cc: Jeff Garzik <jgarzik@pobox.com>
      Cc: Dave Chinner <david@fromorbit.com>
      Cc: Steven Whitehouse <swhiteho@redhat.com>
      6370a6ad
    • Tejun Heo's avatar
      workqueue: fix HIGHPRI handling in keep_working() · 30310045
      Tejun Heo authored
      The policy function keep_working() didn't check GCWQ_HIGHPRI_PENDING
      and could return %false with highpri work pending.  This could lead to
      late execution of a highpri work which was delayed due to @max_active
      throttling if other works are actively consuming CPU cycles.
      
      For example, the following could happen.
      
      1. Work W0 which burns CPU cycles.
      
      2. Two works W1 and W2 are queued to a highpri wq w/ @max_active of 1.
      
      3. W1 starts executing and W2 is put to delayed queue.  W0 and W1 are
         both runnable.
      
      4. W1 finishes which puts W2 to pending queue but keep_working()
         incorrectly returns %false and the worker goes to sleep.
      
      5. W0 finishes and W2 starts execution.
      
      With this patch applied, W2 starts execution as soon as W1 finishes.
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      30310045
  2. 05 Oct, 2010 2 commits
    • Tejun Heo's avatar
      workqueue: add queue_work and activate_work trace points · cdadf009
      Tejun Heo authored
      These two tracepoints allow tracking when and how a work is queued and
      activated.  This patch is based on Frederic's patch to add queue_work
      trace point.
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      cdadf009
    • Tejun Heo's avatar
      workqueue: prepare for more tracepoints · 97bd2347
      Tejun Heo authored
      Define workqueue_work event class and use it for workqueue_execute_end
      trace point.  Also, move trace/events/workqueue.h include downwards
      such that all struct definitions are visible to it.  This is to
      prepare for more tracepoints and doesn't cause any functional change.
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      97bd2347
  3. 19 Sep, 2010 4 commits
    • Tejun Heo's avatar
      workqueue: implement flush[_delayed]_work_sync() · 09383498
      Tejun Heo authored
      Implement flush[_delayed]_work_sync().  These are flush functions
      which also make sure no CPU is still executing the target work from
      earlier queueing instances.  These are similar to
      cancel[_delayed]_work_sync() except that the target work item is
      flushed instead of cancelled.
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      09383498
    • Tejun Heo's avatar
      workqueue: factor out start_flush_work() · baf59022
      Tejun Heo authored
      Factor out start_flush_work() from flush_work().  start_flush_work()
      has @wait_executing argument which controls whether the barrier is
      queued only if the work is pending or also if executing.  As
      flush_work() needs to wait for execution too, it uses %true.
      
      This commit doesn't cause any behavior difference.  start_flush_work()
      will be used to implement flush_work_sync().
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      baf59022
    • Tejun Heo's avatar
      workqueue: cleanup flush/cancel functions · 401a8d04
      Tejun Heo authored
      Make the following cleanup changes.
      
      * Relocate flush/cancel function prototypes and definitions.
      
      * Relocate wait_on_cpu_work() and wait_on_work() before
        try_to_grab_pending().  These will be used to implement
        flush_work_sync().
      
      * Make all flush/cancel functions return bool instead of int.
      
      * Update wait_on_cpu_work() and wait_on_work() to return %true if they
        actually waited.
      
      * Add / update comments.
      
      This patch doesn't cause any functional changes.
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      401a8d04
    • Tejun Heo's avatar
      workqueue: implement alloc_ordered_workqueue() · 81dcaf65
      Tejun Heo authored
      alloc_ordered_workqueue() creates a workqueue which processes each
      work itemp one by one in the queued order.  This will be used to
      replace create_freezeable_workqueue() and
      create_singlethread_workqueue().
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      81dcaf65
  4. 17 Sep, 2010 19 commits
  5. 16 Sep, 2010 13 commits