Re: [RFC PATCH 03/14] kthread: Add drain_kthread_worker()

2015-07-29 Thread Tejun Heo
Hello, Petr. On Wed, Jul 29, 2015 at 12:04:57PM +0200, Petr Mladek wrote: > > I'm not sure full-on chained work detection is necessary here. > > kthread worker's usages tend to be significantly simpler and draining > > is only gonna be used for destruction. > > I think that it might be useful to

Re: [RFC PATCH 03/14] kthread: Add drain_kthread_worker()

2015-07-29 Thread Petr Mladek
On Tue 2015-07-28 13:18:22, Tejun Heo wrote: > Hello, > > On Tue, Jul 28, 2015 at 04:39:20PM +0200, Petr Mladek wrote: > > +/* > > + * Test whether @work is being queued from another work > > + * executing on the same kthread. > > + */ > > +static bool is_chained_work(struct kthread_worker *worker

Re: [RFC PATCH 03/14] kthread: Add drain_kthread_worker()

2015-07-28 Thread Tejun Heo
Hello, On Tue, Jul 28, 2015 at 04:39:20PM +0200, Petr Mladek wrote: > +/* > + * Test whether @work is being queued from another work > + * executing on the same kthread. > + */ > +static bool is_chained_work(struct kthread_worker *worker) > +{ > + struct kthread_worker *current_worker; > + > +

[RFC PATCH 03/14] kthread: Add drain_kthread_worker()

2015-07-28 Thread Petr Mladek
flush_kthread_worker() returns when the currently queued works are proceed. But some other works might have been queued in the meantime. This patch adds drain_kthread_work() that is inspired by drain_workqueue(). It returns when the queue is completely empty. Also it affects the behavior of queue_