On 05/17/2014 12:16 AM, Frederic Weisbecker wrote:

> @@ -3708,6 +3712,13 @@ static void rcu_free_pwq(struct rcu_head *rcu)
>                       container_of(rcu, struct pool_workqueue, rcu));
>  }
>  
> +static struct pool_workqueue *oldest_pwq(struct workqueue_struct *wq)
> +{
> +     return list_last_entry(&wq->pwqs, struct pool_workqueue, pwqs_node);
> +}
> +
> +static void pwq_adjust_max_active(struct pool_workqueue *pwq);


Hi, Tejun,

Should we reorder the pwq_adjust_max_active() to avoid this declare?
(Move pwq_adjust_max_active() to the place just before rcu_free_pwq())

Thanks,
Lai

> +
>  /*
>   * Scheduled on system_wq by put_pwq() when an unbound pwq hits zero refcnt
>   * and needs to be destroyed.
> @@ -3723,14 +3734,12 @@ static void pwq_unbound_release_workfn(struct 
> work_struct *work)
>       if (WARN_ON_ONCE(!(wq->flags & WQ_UNBOUND)))
>               return;
>  
> -     /*
> -      * Unlink @pwq.  Synchronization against wq->mutex isn't strictly
> -      * necessary on release but do it anyway.  It's easier to verify
> -      * and consistent with the linking path.
> -      */
>       mutex_lock(&wq->mutex);
>       list_del_rcu(&pwq->pwqs_node);
>       is_last = list_empty(&wq->pwqs);
> +     /* try to activate the oldest pwq when needed */
> +     if (!is_last && (wq->flags & __WQ_ORDERED))
> +             pwq_adjust_max_active(oldest_pwq(wq));
>       mutex_unlock(&wq->mutex);
>  
>       mutex_lock(&wq_pool_mutex);
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to