Re: [RFC PATCH 09/18] kthread: Make it easier to correctly sleep in iterant kthreads

2015-06-10 Thread Jiri Kosina
On Wed, 10 Jun 2015, Steven Rostedt wrote: > > Right, and I had not considered that, but it turns out the hung_task > > detector checks p->state == TASK_UNINTERRUPTIBLE, so TASK_IDLE is indeed > > safe from that. > > Also, I would assume that TASK_IDLE only makes sense for kernel > threads, I

Re: [RFC PATCH 09/18] kthread: Make it easier to correctly sleep in iterant kthreads

2015-06-10 Thread Steven Rostedt
On Wed, 10 Jun 2015 11:07:24 +0200 Peter Zijlstra wrote: > > Not to mention, tasks in TASK_UNINTERRUPTIBLE state for too long will > > trigger hung task detection. > > Right, and I had not considered that, but it turns out the hung_task > detector checks p->state == TASK_UNINTERRUPTIBLE, so

Re: [RFC PATCH 09/18] kthread: Make it easier to correctly sleep in iterant kthreads

2015-06-10 Thread Peter Zijlstra
On Mon, Jun 08, 2015 at 01:48:10PM -0400, Steven Rostedt wrote: > > commit 80ed87c8a9ca0cad7ca66cf3bbdfb17559a66dcf > > Author: Peter Zijlstra > > Date: Fri May 8 14:23:45 2015 +0200 > > > > sched/wait: Introduce TASK_NOLOAD and TASK_IDLE > > > > Currently people use

Re: [RFC PATCH 09/18] kthread: Make it easier to correctly sleep in iterant kthreads

2015-06-10 Thread Peter Zijlstra
On Tue, Jun 09, 2015 at 05:25:26PM +0200, Petr Mladek wrote: > On Mon 2015-06-08 13:39:55, Peter Zijlstra wrote: > > On Mon, 2015-06-08 at 12:01 +0200, Petr Mladek wrote: > > > > > Just to be sure. Do you suggest to use TASK_IDLE everywhere in > > > kthreads or only when the uninterruptible sleep

Re: [RFC PATCH 09/18] kthread: Make it easier to correctly sleep in iterant kthreads

2015-06-10 Thread Peter Zijlstra
On Tue, Jun 09, 2015 at 05:25:26PM +0200, Petr Mladek wrote: On Mon 2015-06-08 13:39:55, Peter Zijlstra wrote: On Mon, 2015-06-08 at 12:01 +0200, Petr Mladek wrote: Just to be sure. Do you suggest to use TASK_IDLE everywhere in kthreads or only when the uninterruptible sleep is really

Re: [RFC PATCH 09/18] kthread: Make it easier to correctly sleep in iterant kthreads

2015-06-10 Thread Peter Zijlstra
On Mon, Jun 08, 2015 at 01:48:10PM -0400, Steven Rostedt wrote: commit 80ed87c8a9ca0cad7ca66cf3bbdfb17559a66dcf Author: Peter Zijlstra pet...@infradead.org Date: Fri May 8 14:23:45 2015 +0200 sched/wait: Introduce TASK_NOLOAD and TASK_IDLE Currently people use

Re: [RFC PATCH 09/18] kthread: Make it easier to correctly sleep in iterant kthreads

2015-06-10 Thread Steven Rostedt
On Wed, 10 Jun 2015 11:07:24 +0200 Peter Zijlstra pet...@infradead.org wrote: Not to mention, tasks in TASK_UNINTERRUPTIBLE state for too long will trigger hung task detection. Right, and I had not considered that, but it turns out the hung_task detector checks p-state ==

Re: [RFC PATCH 09/18] kthread: Make it easier to correctly sleep in iterant kthreads

2015-06-10 Thread Jiri Kosina
On Wed, 10 Jun 2015, Steven Rostedt wrote: Right, and I had not considered that, but it turns out the hung_task detector checks p-state == TASK_UNINTERRUPTIBLE, so TASK_IDLE is indeed safe from that. Also, I would assume that TASK_IDLE only makes sense for kernel threads, I wonder if we

Re: [RFC PATCH 09/18] kthread: Make it easier to correctly sleep in iterant kthreads

2015-06-09 Thread Petr Mladek
On Mon 2015-06-08 13:39:55, Peter Zijlstra wrote: > On Mon, 2015-06-08 at 12:01 +0200, Petr Mladek wrote: > > > Just to be sure. Do you suggest to use TASK_IDLE everywhere in > > kthreads or only when the uninterruptible sleep is really needed? > > Always, only use INTERRUPTIBLE when you're

Re: [RFC PATCH 09/18] kthread: Make it easier to correctly sleep in iterant kthreads

2015-06-09 Thread Tejun Heo
Hello, On Mon, Jun 08, 2015 at 12:01:07PM +0200, Petr Mladek wrote: > BTW: What is the preferred way of freezing, please? Is it better > to end up in the fridge or is it fine to call freezer_do_not_count(); > or set PF_NOFREEZE when it is safe? There's no one good answer. The closest would be

Re: [RFC PATCH 09/18] kthread: Make it easier to correctly sleep in iterant kthreads

2015-06-09 Thread Tejun Heo
Hello, On Mon, Jun 08, 2015 at 12:01:07PM +0200, Petr Mladek wrote: BTW: What is the preferred way of freezing, please? Is it better to end up in the fridge or is it fine to call freezer_do_not_count(); or set PF_NOFREEZE when it is safe? There's no one good answer. The closest would be

Re: [RFC PATCH 09/18] kthread: Make it easier to correctly sleep in iterant kthreads

2015-06-09 Thread Petr Mladek
On Mon 2015-06-08 13:39:55, Peter Zijlstra wrote: On Mon, 2015-06-08 at 12:01 +0200, Petr Mladek wrote: Just to be sure. Do you suggest to use TASK_IDLE everywhere in kthreads or only when the uninterruptible sleep is really needed? Always, only use INTERRUPTIBLE when you're actually

Re: [RFC PATCH 09/18] kthread: Make it easier to correctly sleep in iterant kthreads

2015-06-08 Thread Steven Rostedt
On Fri, 5 Jun 2015 18:10:21 +0200 Peter Zijlstra wrote: > On Fri, Jun 05, 2015 at 05:01:08PM +0200, Petr Mladek wrote: > > Many kthreads go into an interruptible sleep when there is nothing > > to do. They should check if anyone did not requested the kthread > > to terminate, freeze, or park in

Re: [RFC PATCH 09/18] kthread: Make it easier to correctly sleep in iterant kthreads

2015-06-08 Thread Peter Zijlstra
On Mon, 2015-06-08 at 12:01 +0200, Petr Mladek wrote: > Just to be sure. Do you suggest to use TASK_IDLE everywhere in > kthreads or only when the uninterruptible sleep is really needed? Always, only use INTERRUPTIBLE when you're actually interruptible, that is you want signals or such muck to

Re: [RFC PATCH 09/18] kthread: Make it easier to correctly sleep in iterant kthreads

2015-06-08 Thread Petr Mladek
On Fri 2015-06-05 18:10:21, Peter Zijlstra wrote: > On Fri, Jun 05, 2015 at 05:01:08PM +0200, Petr Mladek wrote: > > Many kthreads go into an interruptible sleep when there is nothing > > to do. They should check if anyone did not requested the kthread > > to terminate, freeze, or park in the

Re: [RFC PATCH 09/18] kthread: Make it easier to correctly sleep in iterant kthreads

2015-06-08 Thread Steven Rostedt
On Fri, 5 Jun 2015 18:10:21 +0200 Peter Zijlstra pet...@infradead.org wrote: On Fri, Jun 05, 2015 at 05:01:08PM +0200, Petr Mladek wrote: Many kthreads go into an interruptible sleep when there is nothing to do. They should check if anyone did not requested the kthread to terminate,

Re: [RFC PATCH 09/18] kthread: Make it easier to correctly sleep in iterant kthreads

2015-06-08 Thread Petr Mladek
On Fri 2015-06-05 18:10:21, Peter Zijlstra wrote: On Fri, Jun 05, 2015 at 05:01:08PM +0200, Petr Mladek wrote: Many kthreads go into an interruptible sleep when there is nothing to do. They should check if anyone did not requested the kthread to terminate, freeze, or park in the meantime.

Re: [RFC PATCH 09/18] kthread: Make it easier to correctly sleep in iterant kthreads

2015-06-08 Thread Peter Zijlstra
On Mon, 2015-06-08 at 12:01 +0200, Petr Mladek wrote: Just to be sure. Do you suggest to use TASK_IDLE everywhere in kthreads or only when the uninterruptible sleep is really needed? Always, only use INTERRUPTIBLE when you're actually interruptible, that is you want signals or such muck to

Re: [RFC PATCH 09/18] kthread: Make it easier to correctly sleep in iterant kthreads

2015-06-05 Thread Peter Zijlstra
On Fri, Jun 05, 2015 at 05:01:08PM +0200, Petr Mladek wrote: > Many kthreads go into an interruptible sleep when there is nothing > to do. They should check if anyone did not requested the kthread > to terminate, freeze, or park in the meantime. It is easy to do > it a wrong way. INTERRUPTIBLE is

Re: [RFC PATCH 09/18] kthread: Make it easier to correctly sleep in iterant kthreads

2015-06-05 Thread Peter Zijlstra
On Fri, Jun 05, 2015 at 05:01:08PM +0200, Petr Mladek wrote: Many kthreads go into an interruptible sleep when there is nothing to do. They should check if anyone did not requested the kthread to terminate, freeze, or park in the meantime. It is easy to do it a wrong way. INTERRUPTIBLE is the