Re: [PATCH v3] stop_machine: Make migration_cpu_stop() does useful works for CONFIG_PREEMPT_NONE

2016-09-14 Thread Oleg Nesterov
On 09/13, Peter Zijlstra wrote: > > On Tue, Sep 13, 2016 at 06:14:27PM +0200, Oleg Nesterov wrote: > > > Hmm. And preempt_enable_no_resched_notrace() under TASK_DEAD in > > __schedule() should be removed it seems, do_exit() can call __schedule() > > directly. > > something like so? Yes, exactly.

Re: [PATCH v3] stop_machine: Make migration_cpu_stop() does useful works for CONFIG_PREEMPT_NONE

2016-09-14 Thread Oleg Nesterov
On 09/13, Peter Zijlstra wrote: > > On Tue, Sep 13, 2016 at 06:14:27PM +0200, Oleg Nesterov wrote: > > > Hmm. And preempt_enable_no_resched_notrace() under TASK_DEAD in > > __schedule() should be removed it seems, do_exit() can call __schedule() > > directly. > > something like so? Yes, exactly.

Re: [PATCH v3] stop_machine: Make migration_cpu_stop() does useful works for CONFIG_PREEMPT_NONE

2016-09-14 Thread Peter Zijlstra
On Wed, Sep 14, 2016 at 10:07:14AM +0800, Cheng Chao wrote: > > great, __schedule() doesn't need pay any attention to the TASK_DEAD now. There's still __schedule()->context_switch()->finish_task_switch().

Re: [PATCH v3] stop_machine: Make migration_cpu_stop() does useful works for CONFIG_PREEMPT_NONE

2016-09-14 Thread Peter Zijlstra
On Wed, Sep 14, 2016 at 10:07:14AM +0800, Cheng Chao wrote: > > great, __schedule() doesn't need pay any attention to the TASK_DEAD now. There's still __schedule()->context_switch()->finish_task_switch().

Re: [PATCH v3] stop_machine: Make migration_cpu_stop() does useful works for CONFIG_PREEMPT_NONE

2016-09-13 Thread Cheng Chao
great, __schedule() doesn't need pay any attention to the TASK_DEAD now. on 09/14/2016 12:37 AM, Peter Zijlstra wrote: > On Tue, Sep 13, 2016 at 06:14:27PM +0200, Oleg Nesterov wrote: > >> Me too, and I failed to find something which could be broken... So >> perhaps should make it nop and

Re: [PATCH v3] stop_machine: Make migration_cpu_stop() does useful works for CONFIG_PREEMPT_NONE

2016-09-13 Thread Cheng Chao
great, __schedule() doesn't need pay any attention to the TASK_DEAD now. on 09/14/2016 12:37 AM, Peter Zijlstra wrote: > On Tue, Sep 13, 2016 at 06:14:27PM +0200, Oleg Nesterov wrote: > >> Me too, and I failed to find something which could be broken... So >> perhaps should make it nop and

Re: [PATCH v3] stop_machine: Make migration_cpu_stop() does useful works for CONFIG_PREEMPT_NONE

2016-09-13 Thread Peter Zijlstra
On Tue, Sep 13, 2016 at 06:14:27PM +0200, Oleg Nesterov wrote: > Me too, and I failed to find something which could be broken... So > perhaps should make it nop and investigate the new bug reports after > that. Works for me :-) > > Hmm. And preempt_enable_no_resched_notrace() under TASK_DEAD

Re: [PATCH v3] stop_machine: Make migration_cpu_stop() does useful works for CONFIG_PREEMPT_NONE

2016-09-13 Thread Peter Zijlstra
On Tue, Sep 13, 2016 at 06:14:27PM +0200, Oleg Nesterov wrote: > Me too, and I failed to find something which could be broken... So > perhaps should make it nop and investigate the new bug reports after > that. Works for me :-) > > Hmm. And preempt_enable_no_resched_notrace() under TASK_DEAD

Re: [PATCH v3] stop_machine: Make migration_cpu_stop() does useful works for CONFIG_PREEMPT_NONE

2016-09-13 Thread Oleg Nesterov
On 09/12, Peter Zijlstra wrote: > > On Mon, Sep 12, 2016 at 03:05:38PM +0200, Oleg Nesterov wrote: > > > But this leads to the question which I wanted to ask many times. > > > > Why cond_resched() is not NOP if CONFIG_PREEMPT=y ? > > Dunno, nobody bothered to do it? We should keep the

Re: [PATCH v3] stop_machine: Make migration_cpu_stop() does useful works for CONFIG_PREEMPT_NONE

2016-09-13 Thread Oleg Nesterov
On 09/12, Peter Zijlstra wrote: > > On Mon, Sep 12, 2016 at 03:05:38PM +0200, Oleg Nesterov wrote: > > > But this leads to the question which I wanted to ask many times. > > > > Why cond_resched() is not NOP if CONFIG_PREEMPT=y ? > > Dunno, nobody bothered to do it? We should keep the

Re: [PATCH v3] stop_machine: Make migration_cpu_stop() does useful works for CONFIG_PREEMPT_NONE

2016-09-13 Thread Peter Zijlstra
On Tue, Sep 13, 2016 at 12:03:05PM +0800, Cheng Chao wrote: > > Peter, Is it as a new patch? I wanted both changes in one pathc, but I fudged my git-diff. > > --- > > kernel/stop_machine.c | 5 + > > 1 file changed, 5 insertions(+) > > > > diff --git a/kernel/stop_machine.c

Re: [PATCH v3] stop_machine: Make migration_cpu_stop() does useful works for CONFIG_PREEMPT_NONE

2016-09-13 Thread Peter Zijlstra
On Tue, Sep 13, 2016 at 12:03:05PM +0800, Cheng Chao wrote: > > Peter, Is it as a new patch? I wanted both changes in one pathc, but I fudged my git-diff. > > --- > > kernel/stop_machine.c | 5 + > > 1 file changed, 5 insertions(+) > > > > diff --git a/kernel/stop_machine.c

Re: [PATCH v3] stop_machine: Make migration_cpu_stop() does useful works for CONFIG_PREEMPT_NONE

2016-09-12 Thread Cheng Chao
Peter, thank you. on 09/12/2016 07:41 PM, Peter Zijlstra wrote: > On Mon, Sep 12, 2016 at 01:37:27PM +0200, Peter Zijlstra wrote: >> So what you're saying is that migration_stop_cpu() doesn't work because >> wait_for_completion() dequeues the task. >> >> True I suppose. Not sure I like your

Re: [PATCH v3] stop_machine: Make migration_cpu_stop() does useful works for CONFIG_PREEMPT_NONE

2016-09-12 Thread Cheng Chao
Peter, thank you. on 09/12/2016 07:41 PM, Peter Zijlstra wrote: > On Mon, Sep 12, 2016 at 01:37:27PM +0200, Peter Zijlstra wrote: >> So what you're saying is that migration_stop_cpu() doesn't work because >> wait_for_completion() dequeues the task. >> >> True I suppose. Not sure I like your

Re: [PATCH v3] stop_machine: Make migration_cpu_stop() does useful works for CONFIG_PREEMPT_NONE

2016-09-12 Thread Cheng Chao
on 09/12/2016 07:03 PM, Oleg Nesterov wrote: > On 09/10, Cheng Chao wrote: >> >> @@ -126,6 +126,17 @@ int stop_one_cpu(unsigned int cpu, cpu_stop_fn_t fn, >> void *arg) >> cpu_stop_init_done(, 1); >> if (!cpu_stop_queue_work(cpu, )) >> return -ENOENT; >> + >> +#if

Re: [PATCH v3] stop_machine: Make migration_cpu_stop() does useful works for CONFIG_PREEMPT_NONE

2016-09-12 Thread Cheng Chao
on 09/12/2016 07:03 PM, Oleg Nesterov wrote: > On 09/10, Cheng Chao wrote: >> >> @@ -126,6 +126,17 @@ int stop_one_cpu(unsigned int cpu, cpu_stop_fn_t fn, >> void *arg) >> cpu_stop_init_done(, 1); >> if (!cpu_stop_queue_work(cpu, )) >> return -ENOENT; >> + >> +#if

Re: [PATCH v3] stop_machine: Make migration_cpu_stop() does useful works for CONFIG_PREEMPT_NONE

2016-09-12 Thread Peter Zijlstra
On Mon, Sep 12, 2016 at 03:05:38PM +0200, Oleg Nesterov wrote: > But this leads to the question which I wanted to ask many times. > > Why cond_resched() is not NOP if CONFIG_PREEMPT=y ? Dunno, nobody bothered to do it? We should keep the might_sleep() of course, but the preemption check is

Re: [PATCH v3] stop_machine: Make migration_cpu_stop() does useful works for CONFIG_PREEMPT_NONE

2016-09-12 Thread Peter Zijlstra
On Mon, Sep 12, 2016 at 03:05:38PM +0200, Oleg Nesterov wrote: > But this leads to the question which I wanted to ask many times. > > Why cond_resched() is not NOP if CONFIG_PREEMPT=y ? Dunno, nobody bothered to do it? We should keep the might_sleep() of course, but the preemption check is

Re: [PATCH v3] stop_machine: Make migration_cpu_stop() does useful works for CONFIG_PREEMPT_NONE

2016-09-12 Thread Oleg Nesterov
On 09/12, Peter Zijlstra wrote: > > --- a/kernel/stop_machine.c > +++ b/kernel/stop_machine.c > @@ -121,6 +121,11 @@ int stop_one_cpu(unsigned int cpu, cpu_stop_fn_t fn, > void *arg) > cpu_stop_init_done(, 1); > if (!cpu_stop_queue_work(cpu, )) > return -ENOENT; > +

Re: [PATCH v3] stop_machine: Make migration_cpu_stop() does useful works for CONFIG_PREEMPT_NONE

2016-09-12 Thread Oleg Nesterov
On 09/12, Peter Zijlstra wrote: > > --- a/kernel/stop_machine.c > +++ b/kernel/stop_machine.c > @@ -121,6 +121,11 @@ int stop_one_cpu(unsigned int cpu, cpu_stop_fn_t fn, > void *arg) > cpu_stop_init_done(, 1); > if (!cpu_stop_queue_work(cpu, )) > return -ENOENT; > +

Re: [PATCH v3] stop_machine: Make migration_cpu_stop() does useful works for CONFIG_PREEMPT_NONE

2016-09-12 Thread Peter Zijlstra
On Mon, Sep 12, 2016 at 01:37:27PM +0200, Peter Zijlstra wrote: > So what you're saying is that migration_stop_cpu() doesn't work because > wait_for_completion() dequeues the task. > > True I suppose. Not sure I like your solution, nor your implementation > of the solution much though. > > I

Re: [PATCH v3] stop_machine: Make migration_cpu_stop() does useful works for CONFIG_PREEMPT_NONE

2016-09-12 Thread Peter Zijlstra
On Mon, Sep 12, 2016 at 01:37:27PM +0200, Peter Zijlstra wrote: > So what you're saying is that migration_stop_cpu() doesn't work because > wait_for_completion() dequeues the task. > > True I suppose. Not sure I like your solution, nor your implementation > of the solution much though. > > I

Re: [PATCH v3] stop_machine: Make migration_cpu_stop() does useful works for CONFIG_PREEMPT_NONE

2016-09-12 Thread Peter Zijlstra
On Sat, Sep 10, 2016 at 04:52:12PM +0800, Cheng Chao wrote: > For CONFIG_PREEMPT_NONE=y, when sched_exec() needs migration, sched_exec() > calls stop_one_cpu(task_cpu(p), migration_cpu_stop, ). > > If the migration_cpu_stop() can not migrate,why do we call stop_one_cpu()? > It just makes the task

Re: [PATCH v3] stop_machine: Make migration_cpu_stop() does useful works for CONFIG_PREEMPT_NONE

2016-09-12 Thread Peter Zijlstra
On Sat, Sep 10, 2016 at 04:52:12PM +0800, Cheng Chao wrote: > For CONFIG_PREEMPT_NONE=y, when sched_exec() needs migration, sched_exec() > calls stop_one_cpu(task_cpu(p), migration_cpu_stop, ). > > If the migration_cpu_stop() can not migrate,why do we call stop_one_cpu()? > It just makes the task

Re: [PATCH v3] stop_machine: Make migration_cpu_stop() does useful works for CONFIG_PREEMPT_NONE

2016-09-12 Thread Oleg Nesterov
On 09/10, Cheng Chao wrote: > > @@ -126,6 +126,17 @@ int stop_one_cpu(unsigned int cpu, cpu_stop_fn_t fn, > void *arg) > cpu_stop_init_done(, 1); > if (!cpu_stop_queue_work(cpu, )) > return -ENOENT; > + > +#if defined(CONFIG_PREEMPT_NONE) > + /* > + * Makes the

Re: [PATCH v3] stop_machine: Make migration_cpu_stop() does useful works for CONFIG_PREEMPT_NONE

2016-09-12 Thread Oleg Nesterov
On 09/10, Cheng Chao wrote: > > @@ -126,6 +126,17 @@ int stop_one_cpu(unsigned int cpu, cpu_stop_fn_t fn, > void *arg) > cpu_stop_init_done(, 1); > if (!cpu_stop_queue_work(cpu, )) > return -ENOENT; > + > +#if defined(CONFIG_PREEMPT_NONE) > + /* > + * Makes the

Re: [PATCH v3] stop_machine: Make migration_cpu_stop() does useful works for CONFIG_PREEMPT_NONE

2016-09-10 Thread Peter Zijlstra
On Sat, Sep 10, 2016 at 05:51:02PM +0800, Cheng Chao wrote: > hi Peter, I guess you can receive the mail from me now, > I have changed the mailbox to gmail. Indeed, I'll have a look on Monday.

Re: [PATCH v3] stop_machine: Make migration_cpu_stop() does useful works for CONFIG_PREEMPT_NONE

2016-09-10 Thread Peter Zijlstra
On Sat, Sep 10, 2016 at 05:51:02PM +0800, Cheng Chao wrote: > hi Peter, I guess you can receive the mail from me now, > I have changed the mailbox to gmail. Indeed, I'll have a look on Monday.

Re: [PATCH v3] stop_machine: Make migration_cpu_stop() does useful works for CONFIG_PREEMPT_NONE

2016-09-10 Thread Cheng Chao
hi Peter, I guess you can receive the mail from me now, I have changed the mailbox to gmail. Oleg has already done much work for this patch, I am really obliged. please review this patch, thanks. on 09/10/2016 04:52 PM, Cheng Chao wrote: > For CONFIG_PREEMPT_NONE=y, when sched_exec() needs

Re: [PATCH v3] stop_machine: Make migration_cpu_stop() does useful works for CONFIG_PREEMPT_NONE

2016-09-10 Thread Cheng Chao
hi Peter, I guess you can receive the mail from me now, I have changed the mailbox to gmail. Oleg has already done much work for this patch, I am really obliged. please review this patch, thanks. on 09/10/2016 04:52 PM, Cheng Chao wrote: > For CONFIG_PREEMPT_NONE=y, when sched_exec() needs

[PATCH v3] stop_machine: Make migration_cpu_stop() does useful works for CONFIG_PREEMPT_NONE

2016-09-10 Thread Cheng Chao
For CONFIG_PREEMPT_NONE=y, when sched_exec() needs migration, sched_exec() calls stop_one_cpu(task_cpu(p), migration_cpu_stop, ). If the migration_cpu_stop() can not migrate,why do we call stop_one_cpu()? It just makes the task TASK_UNINTERRUPTIBLE, wakes up the stopper thread, executes

[PATCH v3] stop_machine: Make migration_cpu_stop() does useful works for CONFIG_PREEMPT_NONE

2016-09-10 Thread Cheng Chao
For CONFIG_PREEMPT_NONE=y, when sched_exec() needs migration, sched_exec() calls stop_one_cpu(task_cpu(p), migration_cpu_stop, ). If the migration_cpu_stop() can not migrate,why do we call stop_one_cpu()? It just makes the task TASK_UNINTERRUPTIBLE, wakes up the stopper thread, executes