Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1482112
| From | Cheng Chao <cs.os.kernel@gmail.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH v3] stop_machine: Make migration_cpu_stop() does useful works for CONFIG_PREEMPT_NONE |
| Date | 2016-09-13 04:50 +0200 |
| Message-ID | <sgLXj-3VL-1@gated-at.bofh.it> (permalink) |
| References | <sfpct-qw-1@gated-at.bofh.it> <sfMiJ-6sU-9@gated-at.bofh.it> <sgxhD-2sv-11@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
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(&done, 1); >> if (!cpu_stop_queue_work(cpu, &work)) >> return -ENOENT; >> + >> +#if defined(CONFIG_PREEMPT_NONE) >> + /* >> + * Makes the stopper thread run as soon as possible. >> + * And if the caller is TASK_RUNNING, keeps the caller TASK_RUNNING. >> + * It's special useful for some callers which are expected to be >> + * TASK_ON_RQ_QUEUED. >> + * sched_exec does benefit from this improvement. >> + */ >> + schedule(); >> +#endif >> wait_for_completion(&done.completion); >> return done.ret; >> } > > Cheng, I already tried twice to suggest to conditionalize this schedule, > because it can only help if cpu == smp_processor_id, and you didn't reply. > I still think _cond_resched() makes more sense. > > I won't really argue if you prefer it this way. But did you see my emails? > I read them, thanks. because Peter didn't receive my mails before, it took me much time to fix my mailbox, so I didn't reply on time. Ok, even if cpu != smp_processor_id(), to call schedule() instead _cond_resched() can give the caller a chance not to sleep. when the caller runs on the cpu again, it may likely find the completion is already done. then the stopper thread cpu_stop_signal_done() and the caller wait_for_completion() will actually run very soon. I think it is trivial improvement. using cond_resched()/_cond_resched() is better for readability, I choose the cond_resched(). thanks again. > Oleg. >
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH v3] stop_machine: Make migration_cpu_stop() does useful works for CONFIG_PREEMPT_NONE Cheng Chao <cs.os.kernel@gmail.com> - 2016-09-10 11:00 +0200
Re: [PATCH v3] stop_machine: Make migration_cpu_stop() does useful works for CONFIG_PREEMPT_NONE Cheng Chao <cs.os.kernel@gmail.com> - 2016-09-10 12:00 +0200
Re: [PATCH v3] stop_machine: Make migration_cpu_stop() does useful works for CONFIG_PREEMPT_NONE Peter Zijlstra <peterz@infradead.org> - 2016-09-10 18:40 +0200
Re: [PATCH v3] stop_machine: Make migration_cpu_stop() does useful works for CONFIG_PREEMPT_NONE Oleg Nesterov <oleg@redhat.com> - 2016-09-12 13:10 +0200
Re: [PATCH v3] stop_machine: Make migration_cpu_stop() does useful works for CONFIG_PREEMPT_NONE Cheng Chao <cs.os.kernel@gmail.com> - 2016-09-13 04:50 +0200
Re: [PATCH v3] stop_machine: Make migration_cpu_stop() does useful works for CONFIG_PREEMPT_NONE Peter Zijlstra <peterz@infradead.org> - 2016-09-12 13:40 +0200
Re: [PATCH v3] stop_machine: Make migration_cpu_stop() does useful works for CONFIG_PREEMPT_NONE Peter Zijlstra <peterz@infradead.org> - 2016-09-12 13:50 +0200
Re: [PATCH v3] stop_machine: Make migration_cpu_stop() does useful works for CONFIG_PREEMPT_NONE Oleg Nesterov <oleg@redhat.com> - 2016-09-12 15:10 +0200
Re: [PATCH v3] stop_machine: Make migration_cpu_stop() does useful works for CONFIG_PREEMPT_NONE Peter Zijlstra <peterz@infradead.org> - 2016-09-12 17:10 +0200
Re: [PATCH v3] stop_machine: Make migration_cpu_stop() does useful works for CONFIG_PREEMPT_NONE Oleg Nesterov <oleg@redhat.com> - 2016-09-13 18:20 +0200
Re: [PATCH v3] stop_machine: Make migration_cpu_stop() does useful works for CONFIG_PREEMPT_NONE Peter Zijlstra <peterz@infradead.org> - 2016-09-13 18:40 +0200
Re: [PATCH v3] stop_machine: Make migration_cpu_stop() does useful works for CONFIG_PREEMPT_NONE Cheng Chao <cs.os.kernel@gmail.com> - 2016-09-14 04:10 +0200
Re: [PATCH v3] stop_machine: Make migration_cpu_stop() does useful works for CONFIG_PREEMPT_NONE Peter Zijlstra <peterz@infradead.org> - 2016-09-14 10:00 +0200
Re: [PATCH v3] stop_machine: Make migration_cpu_stop() does useful works for CONFIG_PREEMPT_NONE Oleg Nesterov <oleg@redhat.com> - 2016-09-14 17:50 +0200
[tip:sched/core] sched/core: Optimize __schedule() tip-bot for Peter Zijlstra <tipbot@zytor.com> - 2016-09-22 16:10 +0200
Re: [PATCH v3] stop_machine: Make migration_cpu_stop() does useful works for CONFIG_PREEMPT_NONE Cheng Chao <cs.os.kernel@gmail.com> - 2016-09-13 06:10 +0200
Re: [PATCH v3] stop_machine: Make migration_cpu_stop() does useful works for CONFIG_PREEMPT_NONE Peter Zijlstra <peterz@infradead.org> - 2016-09-13 10:50 +0200
[PATCH v4] stop_machine: Avoid a sleep and wakeup in the stop_one_cpu() Cheng Chao <cs.os.kernel@gmail.com> - 2016-09-14 04:10 +0200
Re: [PATCH v4] stop_machine: Avoid a sleep and wakeup in the stop_one_cpu() Oleg Nesterov <oleg@redhat.com> - 2016-09-14 18:00 +0200
Re: [PATCH v4] stop_machine: Avoid a sleep and wakeup in the stop_one_cpu() Cheng Chao <cs.os.kernel@gmail.com> - 2016-09-18 04:10 +0200
[tip:sched/core] stop_machine: Avoid a sleep and wakeup in stop_one_cpu() tip-bot for Cheng Chao <tipbot@zytor.com> - 2016-09-22 16:10 +0200
csiph-web