Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1405198

Re: [patch] sched/fair: Move se->vruntime normalization state into struct sched_entity

From Mike Galbraith <umgwanakikbuti@gmail.com>
Newsgroups linux.kernel
Subject Re: [patch] sched/fair: Move se->vruntime normalization state into struct sched_entity
Date 2016-05-23 11:50 +0200
Message-ID <rBUEN-48A-7@gated-at.bofh.it> (permalink)
References (1 earlier) <rxjXd-7jo-29@gated-at.bofh.it> <rBfLk-4uH-7@gated-at.bofh.it> <rBkrE-7qE-13@gated-at.bofh.it> <rBvGp-6hJ-1@gated-at.bofh.it> <rBUbM-3YT-19@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Mon, 2016-05-23 at 11:19 +0200, Peter Zijlstra wrote:
> On Sun, May 22, 2016 at 09:00:01AM +0200, Mike Galbraith wrote:
> > On Sat, 2016-05-21 at 21:00 +0200, Mike Galbraith wrote:
> > > On Sat, 2016-05-21 at 16:04 +0200, Mike Galbraith wrote:
> > > 
> > > > Wakees that were not migrated/normalized eat an unwanted min_vruntime,
> > > > and likely take a size XXL latency hit.  Big box running master bled
> > > > profusely under heavy load until I turned TTWU_QUEUE off.
> > 
> > May as well make it official and against master.today.  Fly or die
> > little patchlet.
> > 
> > sched/fair: Move se->vruntime normalization state into struct sched_entity
> 
> Does this work?

Yup, bugs--.  Kinda funny, I considered ~this way first, but thought
you'd not that approach.. dang, got it back-assward ;-)

> ---
>  include/linux/sched.h |  1 +
>  kernel/sched/core.c   | 18 +++++++++++-------
>  2 files changed, 12 insertions(+), 7 deletions(-)
> 
> diff --git a/include/linux/sched.h b/include/linux/sched.h
> index 1b43b45a22b9..a2001e01b3df 100644
> --- a/include/linux/sched.h
> +++ b/include/linux/sched.h
> @@ -1534,6 +1534,7 @@ struct task_struct {
>  	unsigned sched_reset_on_fork:1;
>  	unsigned sched_contributes_to_load:1;
>  	unsigned sched_migrated:1;
> +	unsigned sched_remote_wakeup:1;
>  	unsigned :0; /* force alignment to the next boundary */
>  
>  	/* unserialized, strictly 'current' */
> diff --git a/kernel/sched/core.c b/kernel/sched/core.c
> index 404c0784b1fc..7f2cae4620c7 100644
> --- a/kernel/sched/core.c
> +++ b/kernel/sched/core.c
> @@ -1768,13 +1768,15 @@ void sched_ttwu_pending(void)
>  	cookie = lockdep_pin_lock(&rq->lock);
>  
>  	while (llist) {
> +		int wake_flags = 0;
> +
>  		p = llist_entry(llist, struct task_struct,
> wake_entry);
>  		llist = llist_next(llist);
> -		/*
> -		 * See ttwu_queue(); we only call
> ttwu_queue_remote() when
> -		 * its a x-cpu wakeup.
> -		 */
> -		ttwu_do_activate(rq, p, WF_MIGRATED, cookie);
> +
> +		if (p->sched_remote_wakeup)
> +			wake_flags = WF_MIGRATED;
> +
> +		ttwu_do_activate(rq, p, wake_flags, cookie);
>  	}
>  
>  	lockdep_unpin_lock(&rq->lock, cookie);
> @@ -1819,10 +1821,12 @@ void scheduler_ipi(void)
>  	irq_exit();
>  }
>  
> -static void ttwu_queue_remote(struct task_struct *p, int cpu)
> +static void ttwu_queue_remote(struct task_struct *p, int cpu, int
> wake_flags)
>  {
>  	struct rq *rq = cpu_rq(cpu);
>  
> +	p->sched_remote_wakeup = !!(wake_flags & WF_MIGRATED);
> +
>  	if (llist_add(&p->wake_entry, &cpu_rq(cpu)->wake_list)) {
>  		if (!set_nr_if_polling(rq->idle))
>  			smp_send_reschedule(cpu);
> @@ -1869,7 +1873,7 @@ static void ttwu_queue(struct task_struct *p,
> int cpu, int wake_flags)
>  #if defined(CONFIG_SMP)
>  	if (sched_feat(TTWU_QUEUE) &&
> !cpus_share_cache(smp_processor_id(), cpu)) {
>  		sched_clock_cpu(cpu); /* sync clocks x-cpu */
> -		ttwu_queue_remote(p, cpu);
> +		ttwu_queue_remote(p, cpu, wake_flags);
>  		return;
>  	}
>  #endif

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Re: [PATCH 2/3] sched,fair: Fix local starvation Mike Galbraith <mgalbraith@suse.de> - 2016-05-21 16:10 +0200
  Re: [PATCH 2/3] sched,fair: Fix local starvation Mike Galbraith <umgwanakikbuti@gmail.com> - 2016-05-21 21:10 +0200
    [patch] sched/fair: Move se->vruntime normalization state into  struct sched_entity Mike Galbraith <umgwanakikbuti@gmail.com> - 2016-05-22 09:10 +0200
      Re: [patch] sched/fair: Move se->vruntime normalization state into  struct sched_entity Peter Zijlstra <peterz@infradead.org> - 2016-05-22 11:40 +0200
        Re: [patch] sched/fair: Move se->vruntime normalization state into  struct sched_entity Mike Galbraith <umgwanakikbuti@gmail.com> - 2016-05-22 12:00 +0200
        Re: [patch] sched/fair: Move se->vruntime normalization state into  struct sched_entity Peter Zijlstra <peterz@infradead.org> - 2016-05-22 12:40 +0200
      Re: [patch] sched/fair: Move se->vruntime normalization state into  struct sched_entity Peter Zijlstra <peterz@infradead.org> - 2016-05-23 11:20 +0200
        Re: [patch] sched/fair: Move se->vruntime normalization state into  struct sched_entity Mike Galbraith <umgwanakikbuti@gmail.com> - 2016-05-23 11:50 +0200
          Re: [patch] sched/fair: Move se->vruntime normalization state into  struct sched_entity Wanpeng Li <kernellwp@gmail.com> - 2016-05-23 12:20 +0200
            Re: [patch] sched/fair: Move se->vruntime normalization state into  struct sched_entity Mike Galbraith <umgwanakikbuti@gmail.com> - 2016-05-23 12:30 +0200
          Re: [patch] sched/fair: Move se->vruntime normalization state into  struct sched_entity Peter Zijlstra <peterz@infradead.org> - 2016-05-23 14:30 +0200
        [tip:sched/urgent] sched/core: Fix remote wakeups tip-bot for Peter Zijlstra <tipbot@zytor.com> - 2016-05-25 09:20 +0200
  Re: [PATCH 2/3] sched,fair: Fix local starvation Wanpeng Li <kernellwp@gmail.com> - 2016-05-22 09:00 +0200
    Re: [PATCH 2/3] sched,fair: Fix local starvation Mike Galbraith <mgalbraith@suse.de> - 2016-05-22 09:20 +0200
      Re: [PATCH 2/3] sched,fair: Fix local starvation Wanpeng Li <kernellwp@gmail.com> - 2016-05-22 09:30 +0200
        Re: [PATCH 2/3] sched,fair: Fix local starvation Mike Galbraith <mgalbraith@suse.de> - 2016-05-22 09:40 +0200
          Re: [PATCH 2/3] sched,fair: Fix local starvation Wanpeng Li <kernellwp@gmail.com> - 2016-05-22 09:50 +0200
            Re: [PATCH 2/3] sched,fair: Fix local starvation Mike Galbraith <mgalbraith@suse.de> - 2016-05-22 10:10 +0200
              Re: [PATCH 2/3] sched,fair: Fix local starvation Wanpeng Li <kernellwp@gmail.com> - 2016-05-22 10:30 +0200
                Re: [PATCH 2/3] sched,fair: Fix local starvation Mike Galbraith <mgalbraith@suse.de> - 2016-05-22 10:40 +0200
                Re: [PATCH 2/3] sched,fair: Fix local starvation Wanpeng Li <kernellwp@gmail.com> - 2016-05-22 11:00 +0200

csiph-web