linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: chengchao <chengchao@kedacom.com>
To: mingo@kernel.org, oleg@redhat.com, peterz@infradead.org,
	tj@kernel.org, akpm@linux-foundation.org,
	chris@chris-wilson.co.uk
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] stop_machine: Make migration_cpu_stop() does useful works for CONFIG_PREEMPT_NONE
Date: Fri, 9 Sep 2016 16:19:01 +0800	[thread overview]
Message-ID: <146661ce-936d-a3e0-5b3c-bd0c742ccc46@kedacom.com> (raw)
In-Reply-To: <1473408834-6122-1-git-send-email-chengchao@kedacom.com>


--in-reply-to doesn't work?

v1 is : 
https://lkml.org/lkml/2016/9/7/819


on 09/09/2016 04:13 PM, 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, &arg).
> 
> 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 migration_cpu_stop(), and the stopper thread wakes up the task.
> 
> But in fact, all above works are almost useless(wasteful),the reason is 
> migration_cpu_stop() can not migrate. why? migration_cpu_stop() needs the 
> task is TASK_ON_RQ_QUEUED before it calls __migrate_task().
> 
> This patch keeps the task TASK_RUNNING instead of TASK_UNINTERRUPTIBLE,
> so the migration_cpu_stop() can do useful works.
> 
> Signed-off-by: Cheng Chao <chengchao@kedacom.com>
> ---
>  kernel/stop_machine.c | 11 +++++++++++
>  1 file changed, 11 insertions(+)
> 
> diff --git a/kernel/stop_machine.c b/kernel/stop_machine.c
> index 4a1ca5f..41aea5e 100644
> --- a/kernel/stop_machine.c
> +++ b/kernel/stop_machine.c
> @@ -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;
>  }
> 

  reply	other threads:[~2016-09-09  8:19 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <OF73BCE1E4.D2224FEC-ON48258025.0022CFA7-48258025.0022E3DC@kedacom.com>
2016-09-09  8:13 ` [PATCH v2] stop_machine: Make migration_cpu_stop() does useful works for CONFIG_PREEMPT_NONE Cheng Chao
2016-09-09  8:19   ` chengchao [this message]
2016-09-09 13:14   ` Oleg Nesterov
2016-09-09 16:24     ` Peter Zijlstra
2016-09-10  8:52   ` [PATCH v3] " Cheng Chao
2016-09-10  9:51     ` Cheng Chao
2016-09-10 16:33       ` Peter Zijlstra
2016-09-12 11:03     ` Oleg Nesterov
2016-09-13  2:45       ` Cheng Chao
2016-09-12 11:37     ` Peter Zijlstra
2016-09-12 11:41       ` Peter Zijlstra
2016-09-12 13:05         ` Oleg Nesterov
2016-09-12 15:01           ` Peter Zijlstra
2016-09-13 16:14             ` Oleg Nesterov
2016-09-13 16:37               ` Peter Zijlstra
2016-09-14  2:07                 ` Cheng Chao
2016-09-14  7:50                   ` Peter Zijlstra
2016-09-14 15:45                 ` Oleg Nesterov
2016-09-22 13:59                 ` [tip:sched/core] sched/core: Optimize __schedule() tip-bot for Peter Zijlstra
2016-09-13  4:03         ` [PATCH v3] stop_machine: Make migration_cpu_stop() does useful works for CONFIG_PREEMPT_NONE Cheng Chao
2016-09-13  8:45           ` Peter Zijlstra
2016-09-14  2:01     ` [PATCH v4] stop_machine: Avoid a sleep and wakeup in the stop_one_cpu() Cheng Chao
2016-09-14 15:53       ` Oleg Nesterov
2016-09-18  2:07       ` Cheng Chao
2016-09-22 13:59       ` [tip:sched/core] stop_machine: Avoid a sleep and wakeup in stop_one_cpu() tip-bot for Cheng Chao

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=146661ce-936d-a3e0-5b3c-bd0c742ccc46@kedacom.com \
    --to=chengchao@kedacom.com \
    --cc=akpm@linux-foundation.org \
    --cc=chris@chris-wilson.co.uk \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=oleg@redhat.com \
    --cc=peterz@infradead.org \
    --cc=tj@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).