Re: [PATCH/RFC] workqueue: allow rescuer thread to do more work.
From: Tejun Heo
Date: Fri Nov 14 2014 - 12:21:53 EST
Hello,
On Tue, Nov 11, 2014 at 09:04:02AM +1100, NeilBrown wrote:
> diff --git a/kernel/workqueue.c b/kernel/workqueue.c
> index 09b685daee3d..f2db6073c498 100644
> --- a/kernel/workqueue.c
> +++ b/kernel/workqueue.c
> @@ -2235,11 +2235,6 @@ repeat:
> struct work_struct *work, *n;
>
> __set_current_state(TASK_RUNNING);
> - list_del_init(&pwq->mayday_node);
> -
> - spin_unlock_irq(&wq_mayday_lock);
> -
> - worker_attach_to_pool(rescuer, pool);
>
> spin_lock_irq(&pool->lock);
> rescuer->pool = pool;
> @@ -2253,8 +2248,16 @@ repeat:
> if (get_work_pwq(work) == pwq)
> move_linked_works(work, scheduled, &n);
>
> - process_scheduled_works(rescuer);
> + if (list_empty(scheduled) || !need_to_create_worker(pool))
> + /* We can let go of this one now */
> + list_del_init(&pwq->mayday_node);
We prolly want to rotate the processed one to the back of the list too
so that the rescuer round robins across multiple mayday requests?
Thanks.
--
tejun
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/