Re: [PATCH v9 06/12] kthread: Add kthread_drain_worker()

2016-06-29 Thread Tejun Heo
Hello, On Wed, Jun 29, 2016 at 10:17:48AM +0200, Petr Mladek wrote: > > Ah, okay, I don't think we need to change this. I was suggesting to > > simplify it by dropping the draining and just do flush from destroy. > > I see. But then it does not address the original concern from Peter >

Re: [PATCH v9 06/12] kthread: Add kthread_drain_worker()

2016-06-29 Thread Tejun Heo
Hello, On Wed, Jun 29, 2016 at 10:17:48AM +0200, Petr Mladek wrote: > > Ah, okay, I don't think we need to change this. I was suggesting to > > simplify it by dropping the draining and just do flush from destroy. > > I see. But then it does not address the original concern from Peter >

Re: [PATCH v9 06/12] kthread: Add kthread_drain_worker()

2016-06-29 Thread Petr Mladek
On Tue 2016-06-28 13:04:47, Tejun Heo wrote: > Hello, > > On Mon, Jun 27, 2016 at 04:33:50PM +0200, Petr Mladek wrote: > > OK, so you suggest to do the following: > > > > 1. Add a flag into struct kthread_worker that will prevent > > from further queuing. > > This doesn't add any

Re: [PATCH v9 06/12] kthread: Add kthread_drain_worker()

2016-06-29 Thread Petr Mladek
On Tue 2016-06-28 13:04:47, Tejun Heo wrote: > Hello, > > On Mon, Jun 27, 2016 at 04:33:50PM +0200, Petr Mladek wrote: > > OK, so you suggest to do the following: > > > > 1. Add a flag into struct kthread_worker that will prevent > > from further queuing. > > This doesn't add any

Re: [PATCH v9 06/12] kthread: Add kthread_drain_worker()

2016-06-28 Thread Tejun Heo
Hello, On Mon, Jun 27, 2016 at 04:33:50PM +0200, Petr Mladek wrote: > OK, so you suggest to do the following: > > 1. Add a flag into struct kthread_worker that will prevent > from further queuing. This doesn't add any protection, right? It's getting freed anyway. > 2.

Re: [PATCH v9 06/12] kthread: Add kthread_drain_worker()

2016-06-28 Thread Tejun Heo
Hello, On Mon, Jun 27, 2016 at 04:33:50PM +0200, Petr Mladek wrote: > OK, so you suggest to do the following: > > 1. Add a flag into struct kthread_worker that will prevent > from further queuing. This doesn't add any protection, right? It's getting freed anyway. > 2.

Re: [PATCH v9 06/12] kthread: Add kthread_drain_worker()

2016-06-27 Thread Petr Mladek
Hi, On Fri 2016-06-24 11:54:47, Tejun Heo wrote: > On Fri, Jun 24, 2016 at 09:05:15AM +0200, Peter Zijlstra wrote: > > > Given how rare that is > > > > Could you then not remove/rework these few cases for workqueue as well > > and make that 'better' too? > > Usage of draining is rare for

Re: [PATCH v9 06/12] kthread: Add kthread_drain_worker()

2016-06-27 Thread Petr Mladek
Hi, On Fri 2016-06-24 11:54:47, Tejun Heo wrote: > On Fri, Jun 24, 2016 at 09:05:15AM +0200, Peter Zijlstra wrote: > > > Given how rare that is > > > > Could you then not remove/rework these few cases for workqueue as well > > and make that 'better' too? > > Usage of draining is rare for

Re: [PATCH v9 06/12] kthread: Add kthread_drain_worker()

2016-06-24 Thread Tejun Heo
Hello, On Fri, Jun 24, 2016 at 09:05:15AM +0200, Peter Zijlstra wrote: > > Given how rare that is > > Could you then not remove/rework these few cases for workqueue as well > and make that 'better' too? Usage of draining is rare for workqueue but that still means several legitimate users.

Re: [PATCH v9 06/12] kthread: Add kthread_drain_worker()

2016-06-24 Thread Tejun Heo
Hello, On Fri, Jun 24, 2016 at 09:05:15AM +0200, Peter Zijlstra wrote: > > Given how rare that is > > Could you then not remove/rework these few cases for workqueue as well > and make that 'better' too? Usage of draining is rare for workqueue but that still means several legitimate users.

Re: [PATCH v9 06/12] kthread: Add kthread_drain_worker()

2016-06-24 Thread Petr Mladek
On Fri 2016-06-24 09:05:15, Peter Zijlstra wrote: > On Thu, Jun 23, 2016 at 05:32:58PM -0400, Tejun Heo wrote: > > Hello, > > > > On Wed, Jun 22, 2016 at 10:54:45PM +0200, Peter Zijlstra wrote: > > > > + * The caller is responsible for blocking all users of this kthread > > > > + * worker from

Re: [PATCH v9 06/12] kthread: Add kthread_drain_worker()

2016-06-24 Thread Petr Mladek
On Fri 2016-06-24 09:05:15, Peter Zijlstra wrote: > On Thu, Jun 23, 2016 at 05:32:58PM -0400, Tejun Heo wrote: > > Hello, > > > > On Wed, Jun 22, 2016 at 10:54:45PM +0200, Peter Zijlstra wrote: > > > > + * The caller is responsible for blocking all users of this kthread > > > > + * worker from

Re: [PATCH v9 06/12] kthread: Add kthread_drain_worker()

2016-06-24 Thread Peter Zijlstra
On Thu, Jun 23, 2016 at 05:32:58PM -0400, Tejun Heo wrote: > Hello, > > On Wed, Jun 22, 2016 at 10:54:45PM +0200, Peter Zijlstra wrote: > > > + * The caller is responsible for blocking all users of this kthread > > > + * worker from queuing new works. Also it is responsible for blocking > > > + *

Re: [PATCH v9 06/12] kthread: Add kthread_drain_worker()

2016-06-24 Thread Peter Zijlstra
On Thu, Jun 23, 2016 at 05:32:58PM -0400, Tejun Heo wrote: > Hello, > > On Wed, Jun 22, 2016 at 10:54:45PM +0200, Peter Zijlstra wrote: > > > + * The caller is responsible for blocking all users of this kthread > > > + * worker from queuing new works. Also it is responsible for blocking > > > + *

Re: [PATCH v9 06/12] kthread: Add kthread_drain_worker()

2016-06-23 Thread Tejun Heo
Hello, On Wed, Jun 22, 2016 at 10:54:45PM +0200, Peter Zijlstra wrote: > > + * The caller is responsible for blocking all users of this kthread > > + * worker from queuing new works. Also it is responsible for blocking > > + * the already queued works from an infinite re-queuing! > > This, I

Re: [PATCH v9 06/12] kthread: Add kthread_drain_worker()

2016-06-23 Thread Tejun Heo
Hello, On Wed, Jun 22, 2016 at 10:54:45PM +0200, Peter Zijlstra wrote: > > + * The caller is responsible for blocking all users of this kthread > > + * worker from queuing new works. Also it is responsible for blocking > > + * the already queued works from an infinite re-queuing! > > This, I

Re: [PATCH v9 06/12] kthread: Add kthread_drain_worker()

2016-06-22 Thread Peter Zijlstra
On Thu, Jun 16, 2016 at 01:17:25PM +0200, Petr Mladek wrote: > +/** > + * kthread_drain_worker - drain a kthread worker > + * @worker: worker to be drained > + * > + * Wait until there is no work queued for the given kthread worker. > + * @worker is flushed repeatedly until it becomes empty. The

Re: [PATCH v9 06/12] kthread: Add kthread_drain_worker()

2016-06-22 Thread Peter Zijlstra
On Thu, Jun 16, 2016 at 01:17:25PM +0200, Petr Mladek wrote: > +/** > + * kthread_drain_worker - drain a kthread worker > + * @worker: worker to be drained > + * > + * Wait until there is no work queued for the given kthread worker. > + * @worker is flushed repeatedly until it becomes empty. The

Re: [PATCH v9 06/12] kthread: Add kthread_drain_worker()

2016-06-20 Thread Tejun Heo
On Thu, Jun 16, 2016 at 01:17:25PM +0200, Petr Mladek wrote: > kthread_flush_worker() returns when the currently queued works are proceed. > But some other works might have been queued in the meantime. > > This patch adds kthread_drain_worker() that is inspired by > drain_workqueue(). It returns

Re: [PATCH v9 06/12] kthread: Add kthread_drain_worker()

2016-06-20 Thread Tejun Heo
On Thu, Jun 16, 2016 at 01:17:25PM +0200, Petr Mladek wrote: > kthread_flush_worker() returns when the currently queued works are proceed. > But some other works might have been queued in the meantime. > > This patch adds kthread_drain_worker() that is inspired by > drain_workqueue(). It returns

[PATCH v9 06/12] kthread: Add kthread_drain_worker()

2016-06-16 Thread Petr Mladek
kthread_flush_worker() returns when the currently queued works are proceed. But some other works might have been queued in the meantime. This patch adds kthread_drain_worker() that is inspired by drain_workqueue(). It returns when the queue is completely empty and warns when it takes too long.

[PATCH v9 06/12] kthread: Add kthread_drain_worker()

2016-06-16 Thread Petr Mladek
kthread_flush_worker() returns when the currently queued works are proceed. But some other works might have been queued in the meantime. This patch adds kthread_drain_worker() that is inspired by drain_workqueue(). It returns when the queue is completely empty and warns when it takes too long.