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 10/15] workqueue: avoid unneeded calls to get_work_cwq()
    Date
    Use already-known "cwq" instead of get_work_cwq(work) in try_to_grab_pending()
    and cwq_activate_first_delayed().

    It avoid unneeded calls to get_work_cwq() which becomes not so light-way
    in later patches.

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

    diff --git a/kernel/workqueue.c b/kernel/workqueue.c
    index e14a03e..7ac6824 100644
    --- a/kernel/workqueue.c
    +++ b/kernel/workqueue.c
    @@ -1012,10 +1012,9 @@ static void move_linked_works(struct work_struct *work, struct list_head *head,
    *nextp = n;
    }

    -static void cwq_activate_delayed_work(struct work_struct *work)
    +static void cwq_activate_delayed_work(struct work_struct *work,
    + struct cpu_workqueue_struct *cwq)
    {
    - struct cpu_workqueue_struct *cwq = get_work_cwq(work);
    -
    trace_workqueue_activate_work(work);
    move_linked_works(work, &cwq->pool->worklist, NULL);
    __clear_bit(WORK_STRUCT_DELAYED_BIT, work_data_bits(work));
    @@ -1027,7 +1026,7 @@ static void cwq_activate_first_delayed(struct cpu_workqueue_struct *cwq)
    struct work_struct *work = list_first_entry(&cwq->delayed_works,
    struct work_struct, entry);

    - cwq_activate_delayed_work(work);
    + cwq_activate_delayed_work(work, cwq);
    }

    /**
    @@ -1147,10 +1146,10 @@ static int try_to_grab_pending(struct work_struct *work, bool is_dwork,
    * item is activated before grabbing.
    */
    if (*work_data_bits(work) & WORK_STRUCT_DELAYED)
    - cwq_activate_delayed_work(work);
    + cwq_activate_delayed_work(work, cwq);

    list_del_init(&work->entry);
    - cwq_dec_nr_in_flight(get_work_cwq(work), get_work_color(work));
    + cwq_dec_nr_in_flight(cwq, get_work_color(work));

    /* work is dequeued, work->data points to pool iff running */
    if (worker)
    --
    1.7.7.6


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