Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1478735
| From | chengchao <chengchao@kedacom.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH] sched/core: simpler function for sched_exec migration |
| Date | 2016-09-08 04:20 +0200 |
| Message-ID | <seX6x-8fF-5@gated-at.bofh.it> (permalink) |
| References | (1 earlier) <se1YC-4eB-17@gated-at.bofh.it> <see9r-422-5@gated-at.bofh.it> <seqtY-3JB-67@gated-at.bofh.it> <seBIJ-2GO-1@gated-at.bofh.it> <seKj0-8cn-19@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
Oled, thank you for moving this patch on.
on 09/07/2016 08:35 PM, Oleg Nesterov wrote:
> On 09/07, chengchao wrote:
>>
>> Oleg, thank you very much.
>>
>> on 09/06/2016 11:22 PM, Oleg Nesterov wrote:
>>> On 09/06, chengchao wrote:
>>>>
>>>> the key point is for CONFIG_PREEMPT_NONE=y,
>>>> ...
>>>> it is too much overhead for one task(fork()+exec()), isn't it?
>>>
>>> Yes, yes, I see, this is suboptimal. Not sure we actually do care,
>>> but yes, perhaps another helper which migrates the current task makes
>>> sense, I dunno.
>>
>> for CONFIG_PREEMPT_NONE=y, this patch wants the stopper thread can migrate the current
>> successfully instead of doing nothing.
>
> I understand the intent. But I am not sure this optimization makes
> sense.
>
For CONFIG_PREEMPT_NONE=y, when sched_exec() needs migration, sched_exec() calls
stop_one_cpu(task_cpu(p), migration_cpu_stop, &arg).
If stopper thread can not migrate for us,why should we call stop_one_cpu() here?
It just makes the task TASK_UNINTERRUPTIBLE, wakes up the stopper thread, executes the
migration_cpu_stop, and the stopper thread wakes up the task.
But in fact, all above works are almost unuseful, the reason is that the migration_cpu_stop
doesn't migrate for us. why? the migration_cpu_stop() needs the task is TASK_ON_RQ_QUEUED
before it calls __migrate_task().
This patch can make the task TASK_RUNNING instead of TASK_UNINTERRUPTIBLE,
so the migration_cpu_stop() can migrate happily.
Does this optimization make sense now?
Any different opinions are always welcome.
>> int stop_one_cpu(unsigned int cpu, cpu_stop_fn_t fn, void *arg)
>> {
>> struct cpu_stop_done done;
>> struct cpu_stop_work work = { .fn = fn, .arg = arg, .done = &done };
>>
>> cpu_stop_init_done(&done, 1);
>> if (!cpu_stop_queue_work(cpu, &work))
>> return -ENOENT;
>>
>> #if defined(CONFIG_PREEMPT_NONE)
>> /*
>> * let the stopper thread runs as soon as possible,
>> * and keep current TASK_RUNNING.
>> */
>> scheudle();
>> #endif
>> wait_for_completion(&done.completion);
>> return done.ret;
>> }
>
> Agreed this looks better, although I'd suggest _cond_resche().
>
> Again, I am not sure this makes sense, I leave this to maintainers.
>
You have done much works for this patch. Thanks again.
> Oleg.
>
>
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH] sched/core: simpler function for sched_exec migration cheng chao <chengchao@kedacom.com> - 2016-09-05 08:30 +0200
Re: [PATCH] sched/core: simpler function for sched_exec migration Oleg Nesterov <oleg@redhat.com> - 2016-09-05 15:20 +0200
Re: [PATCH] sched/core: simpler function for sched_exec migration chengchao <chengchao@kedacom.com> - 2016-09-06 04:20 +0200
Re: [PATCH] sched/core: simpler function for sched_exec migration Oleg Nesterov <oleg@redhat.com> - 2016-09-06 17:30 +0200
Re: [PATCH] sched/core: simpler function for sched_exec migration chengchao <chengchao@kedacom.com> - 2016-09-07 05:30 +0200
Re: [PATCH] sched/core: simpler function for sched_exec migration Oleg Nesterov <oleg@redhat.com> - 2016-09-07 14:40 +0200
Re: [PATCH] sched/core: simpler function for sched_exec migration chengchao <chengchao@kedacom.com> - 2016-09-08 04:20 +0200
Re: [PATCH] sched/core: simpler function for sched_exec migration Peter Zijlstra <peterz@infradead.org> - 2016-09-09 12:10 +0200
csiph-web