LKML Archive on lore.kernel.org
 help / color / Atom feed
From: Viresh Kumar <viresh.kumar@linaro.org>
To: Peter Zijlstra <peterz@infradead.org>
Cc: Valentin Schneider <valentin.schneider@arm.com>,
	Ingo Molnar <mingo@redhat.com>,
	Vincent Guittot <vincent.guittot@linaro.org>,
	Daniel Lezcano <daniel.lezcano@linaro.org>,
	linux-kernel@vger.kernel.org,
	Quentin Perret <quentin.perret@arm.com>,
	c@hirez.programming.kicks-ass.net
Subject: Re: [PATCH] sched/fair: Rearrange select_task_rq_fair() to optimize it
Date: Wed, 25 Apr 2018 10:45:09 +0530
Message-ID: <20180425051509.aohopadqw7q5urbd@vireshk-i7> (raw)
In-Reply-To: <20180424123523.GF4064@hirez.programming.kicks-ass.net>

On 24-04-18, 14:35, Peter Zijlstra wrote:
> In any case, if there not going to be conflicts here, this all looks
> good.

Thanks Peter.

I also had another patch and wasn't sure if that would be the right
thing to do. The main purpose of this is to avoid calling
sync_entity_load_avg() unnecessarily.

+++ b/kernel/sched/fair.c
@@ -6196,9 +6196,6 @@ static inline int find_idlest_cpu(struct sched_domain *sd, struct task_struct *p
 {
        int new_cpu = cpu;
 
-       if (!cpumask_intersects(sched_domain_span(sd), &p->cpus_allowed))
-               return prev_cpu;
-
        while (sd) {
                struct sched_group *group;
                struct sched_domain *tmp;
@@ -6652,15 +6649,19 @@ select_task_rq_fair(struct task_struct *p, int prev_cpu, int sd_flag, int wake_f
        if (unlikely(sd)) {
                /* Slow path */
 
-               /*
-                * We're going to need the task's util for capacity_spare_wake
-                * in find_idlest_group. Sync it up to prev_cpu's
-                * last_update_time.
-                */
-               if (!(sd_flag & SD_BALANCE_FORK))
-                       sync_entity_load_avg(&p->se);
+               if (!cpumask_intersects(sched_domain_span(sd), &p->cpus_allowed)) {
+                       new_cpu = prev_cpu;
+               } else {
+                       /*
+                        * We're going to need the task's util for
+                        * capacity_spare_wake in find_idlest_group. Sync it up
+                        * to prev_cpu's last_update_time.
+                        */
+                       if (!(sd_flag & SD_BALANCE_FORK))
+                               sync_entity_load_avg(&p->se);
 
-               new_cpu = find_idlest_cpu(sd, p, cpu, prev_cpu, sd_flag);
+                       new_cpu = find_idlest_cpu(sd, p, cpu, prev_cpu, sd_flag);
+               }
        } else if (sd_flag & SD_BALANCE_WAKE) { /* XXX always ? */
                /* Fast path */

-- 
viresh

  parent reply index

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-23 10:38 Viresh Kumar
2018-04-24 10:02 ` Valentin Schneider
2018-04-24 10:30   ` Viresh Kumar
2018-04-24 10:43   ` Peter Zijlstra
2018-04-24 11:19     ` Valentin Schneider
2018-04-24 12:35       ` Peter Zijlstra
2018-04-24 15:46         ` Joel Fernandes
2018-04-24 15:47           ` Joel Fernandes
2018-04-24 22:34             ` Rohit Jain
2018-04-25  2:51               ` Viresh Kumar
2018-04-25 16:48                 ` Rohit Jain
2018-04-25  5:15         ` Viresh Kumar [this message]
2018-04-25  8:13           ` Quentin Perret
2018-04-25  9:03             ` Viresh Kumar
2018-04-25  9:39               ` Quentin Perret
2018-04-25 10:13                 ` Viresh Kumar
2018-04-25 10:55                   ` Quentin Perret
2018-04-25  8:12         ` Quentin Perret

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=20180425051509.aohopadqw7q5urbd@vireshk-i7 \
    --to=viresh.kumar@linaro.org \
    --cc=c@hirez.programming.kicks-ass.net \
    --cc=daniel.lezcano@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=quentin.perret@arm.com \
    --cc=valentin.schneider@arm.com \
    --cc=vincent.guittot@linaro.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

LKML Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/lkml/0 lkml/git/0.git
	git clone --mirror https://lore.kernel.org/lkml/1 lkml/git/1.git
	git clone --mirror https://lore.kernel.org/lkml/2 lkml/git/2.git
	git clone --mirror https://lore.kernel.org/lkml/3 lkml/git/3.git
	git clone --mirror https://lore.kernel.org/lkml/4 lkml/git/4.git
	git clone --mirror https://lore.kernel.org/lkml/5 lkml/git/5.git
	git clone --mirror https://lore.kernel.org/lkml/6 lkml/git/6.git
	git clone --mirror https://lore.kernel.org/lkml/7 lkml/git/7.git
	git clone --mirror https://lore.kernel.org/lkml/8 lkml/git/8.git
	git clone --mirror https://lore.kernel.org/lkml/9 lkml/git/9.git
	git clone --mirror https://lore.kernel.org/lkml/10 lkml/git/10.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 lkml lkml/ https://lore.kernel.org/lkml \
		linux-kernel@vger.kernel.org
	public-inbox-index lkml

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-kernel


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git