lkml.org 
[lkml]   [2013]   [Feb]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH V2 05/15] workqueue: only set pool id when the work is running
    Date
    When a work is dequeued via try_to_grab_pending(), its pool id is recored
    in work->data. but this recording is useless when the work is not running.

    In this patch, we only record pool id when the work is running.

    Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com>
    ---
    kernel/workqueue.c | 11 +++++++++--
    1 files changed, 9 insertions(+), 2 deletions(-)

    diff --git a/kernel/workqueue.c b/kernel/workqueue.c
    index 5502188..06d6211 100644
    --- a/kernel/workqueue.c
    +++ b/kernel/workqueue.c
    @@ -1139,6 +1139,8 @@ static int try_to_grab_pending(struct work_struct *work, bool is_dwork,
    goto fail;

    if (cwq) {
    + int pool_id;
    +
    debug_work_deactivate(work);

    /*
    @@ -1154,8 +1156,13 @@ static int try_to_grab_pending(struct work_struct *work, bool is_dwork,
    list_del_init(&work->entry);
    cwq_dec_nr_in_flight(get_work_cwq(work), get_work_color(work));

    - /* work->data points to cwq iff queued, point to pool */
    - set_work_pool_and_keep_pending(work, pool->id);
    + /* work is dequeued, work->data points to pool iff running */
    + if (worker)
    + pool_id = pool->id;
    + else
    + pool_id = WORK_OFFQ_POOL_NONE;
    +
    + set_work_pool_and_keep_pending(work, pool_id);

    spin_unlock(&pool->lock);
    return 1;
    --
    1.7.7.6


    \
     
     \ /
      Last update: 2013-02-18 18:21    [W:3.347 / U:0.444 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site