From patchwork Thu Apr 25 17:23:29 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vincent Guittot X-Patchwork-Id: 16407 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-gh0-f198.google.com (mail-gh0-f198.google.com [209.85.160.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 890FC2395D for ; Thu, 25 Apr 2013 17:26:11 +0000 (UTC) Received: by mail-gh0-f198.google.com with SMTP id r11sf5058173ghr.9 for ; Thu, 25 Apr 2013 10:25:17 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:mime-version:x-beenthere:x-received:received-spf :x-received:x-forwarded-to:x-forwarded-for:delivered-to:x-received :received-spf:x-received:from:to:cc:subject:date:message-id:x-mailer :in-reply-to:references:x-gm-message-state:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :x-google-group-id:list-post:list-help:list-archive:list-unsubscribe; bh=U3L3QHmkh/JOr2BRqVJB+gpD6Kq+CkZMynV6kGjJNao=; b=ox/KmoklyV0hUmtvJ50OpPdhaiLjRt2YZYPYedQ5pd6nKqtPeR4eMinpYF1a7rW2kK XbeULgs/8GCYgVySriNW+LpXuJnH02garetUtf1f22XT7vrbcledkOYRjNvCAuhlWROR XDPALwSWeMq/HsUx5MCZasCAfgful+2cqMGcRDKhevJ9BiqeWxPy8uL/8R214q7rpVs4 odP0dEt7AF9Jt8k+zzDCQdBkI0JLy6H1YIN1iGubtvRJbI0cP5D43m881/INcd4zCJ+9 K0uVtI4D5Gzhvd/tqYOmk/PDKTyXxoFmpPZjQXFwE5wKpzSpZyTFrBIhndjGya7kb+MX Qyxw== X-Received: by 10.236.43.72 with SMTP id k48mr3349826yhb.35.1366910717776; Thu, 25 Apr 2013 10:25:17 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.18.168 with SMTP id x8ls1512897qed.75.gmail; Thu, 25 Apr 2013 10:25:17 -0700 (PDT) X-Received: by 10.52.120.101 with SMTP id lb5mr2904714vdb.11.1366910717606; Thu, 25 Apr 2013 10:25:17 -0700 (PDT) Received: from mail-vc0-f171.google.com (mail-vc0-f171.google.com [209.85.220.171]) by mx.google.com with ESMTPS id ir6si3661536vdb.104.2013.04.25.10.25.17 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 25 Apr 2013 10:25:17 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.220.171 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.220.171; Received: by mail-vc0-f171.google.com with SMTP id ha12so482180vcb.30 for ; Thu, 25 Apr 2013 10:25:17 -0700 (PDT) X-Received: by 10.52.163.231 with SMTP id yl7mr23392034vdb.57.1366910717518; Thu, 25 Apr 2013 10:25:17 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.58.127.98 with SMTP id nf2csp32677veb; Thu, 25 Apr 2013 10:25:17 -0700 (PDT) X-Received: by 10.194.177.225 with SMTP id ct1mr38666220wjc.16.1366910716647; Thu, 25 Apr 2013 10:25:16 -0700 (PDT) Received: from mail-wg0-x22c.google.com (mail-wg0-x22c.google.com [2a00:1450:400c:c00::22c]) by mx.google.com with ESMTPS id ma18si2738252wic.52.2013.04.25.10.25.16 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 25 Apr 2013 10:25:16 -0700 (PDT) Received-SPF: neutral (google.com: 2a00:1450:400c:c00::22c is neither permitted nor denied by best guess record for domain of vincent.guittot@linaro.org) client-ip=2a00:1450:400c:c00::22c; Received: by mail-wg0-f44.google.com with SMTP id a12so1595696wgh.11 for ; Thu, 25 Apr 2013 10:25:16 -0700 (PDT) X-Received: by 10.194.122.131 with SMTP id ls3mr19896299wjb.55.1366910716264; Thu, 25 Apr 2013 10:25:16 -0700 (PDT) Received: from localhost.localdomain (LPuteaux-156-14-44-212.w82-127.abo.wanadoo.fr. [82.127.83.212]) by mx.google.com with ESMTPSA id q13sm12311485wie.8.2013.04.25.10.25.14 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 25 Apr 2013 10:25:15 -0700 (PDT) From: Vincent Guittot To: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linaro-kernel@lists.linaro.org, peterz@infradead.org, mingo@kernel.org, linux@arm.linux.org.uk, pjt@google.com, santosh.shilimkar@ti.com, Morten.Rasmussen@arm.com, chander.kashyap@linaro.org, cmetcalf@tilera.com, tony.luck@intel.com, alex.shi@intel.com, preeti@linux.vnet.ibm.com Cc: paulmck@linux.vnet.ibm.com, tglx@linutronix.de, len.brown@intel.com, arjan@linux.intel.com, amit.kucheria@linaro.org, corbet@lwn.net, l.majewski@samsung.com, Vincent Guittot Subject: [PATCH 13/14] sched: update the cpu_power Date: Thu, 25 Apr 2013 19:23:29 +0200 Message-Id: <1366910611-20048-14-git-send-email-vincent.guittot@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1366910611-20048-1-git-send-email-vincent.guittot@linaro.org> References: <1366910611-20048-1-git-send-email-vincent.guittot@linaro.org> X-Gm-Message-State: ALoCoQlJY++hOZm4ceqFcoZMGKL58c/QZ+brpjKE/od11otmNFODR3nmgoRxdQ1bp4lZszvuEOd7 X-Original-Sender: vincent.guittot@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.220.171 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , The cpu_power is updated for CPUs that don't participate to the packing effort. We consider that their cpu_power is allocated to idleness as it could be allocated by rt. So the cpu_power that remains available for cfs, is set to min value (i.e. 1) Signed-off-by: Vincent Guittot --- kernel/sched/fair.c | 35 ++++++++++++++++++++--------------- 1 file changed, 20 insertions(+), 15 deletions(-) diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index 756b1e3..54c1541 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -224,12 +224,12 @@ void update_packing_domain(int cpu) /* loop the sched groups to find the best one */ for (tmp = sg->next; tmp != sg; tmp = tmp->next) { - if (tmp->sgp->power * pack->group_weight > - pack->sgp->power * tmp->group_weight) + if (tmp->sgp->power_available * pack->group_weight > + pack->sgp->power_available * tmp->group_weight) continue; - if ((tmp->sgp->power * pack->group_weight == - pack->sgp->power * tmp->group_weight) + if ((tmp->sgp->power_available * pack->group_weight == + pack->sgp->power_available * tmp->group_weight) && (cpumask_first(sched_group_cpus(tmp)) >= id)) continue; @@ -269,12 +269,12 @@ void update_packing_buddy(int cpu, int activity) /* loop the sched groups to find the best one */ for (tmp = sg->next; tmp != sg; tmp = tmp->next) { - if ((tmp->sgp->power * pack->group_weight) > + if ((tmp->sgp->power_available * pack->group_weight) > (pack->sgp->power_available * tmp->group_weight)) continue; - if (((tmp->sgp->power * pack->group_weight) == - (pack->sgp->power * tmp->group_weight)) + if (((tmp->sgp->power_available * pack->group_weight) == + (pack->sgp->power_available * tmp->group_weight)) && (cpumask_first(sched_group_cpus(tmp)) >= id)) continue; @@ -285,20 +285,20 @@ void update_packing_buddy(int cpu, int activity) id = cpumask_first(sched_group_cpus(pack)); } - if ((cpu == id) || (activity <= power_of(id))) { + if ((cpu == id) || (activity <= available_of(id))) { per_cpu(sd_pack_buddy, cpu) = id; return; } for (tmp = pack; activity > 0; tmp = tmp->next) { - if (tmp->sgp->power > activity) { + if (tmp->sgp->power_available > activity) { id = cpumask_first(sched_group_cpus(tmp)); - activity -= power_of(id); + activity -= available_of(id); if (cpu == id) activity = 0; while ((activity > 0) && (id < nr_cpu_ids)) { id = cpumask_next(id, sched_group_cpus(tmp)); - activity -= power_of(id); + activity -= available_of(id); if (cpu == id) activity = 0; } @@ -306,7 +306,7 @@ void update_packing_buddy(int cpu, int activity) id = cpu; activity = 0; } else { - activity -= tmp->sgp->power; + activity -= tmp->sgp->power_available; } } @@ -3369,7 +3369,8 @@ find_idlest_group(struct sched_domain *sd, struct task_struct *p, } /* Adjust by relative CPU power of the group */ - avg_load = (avg_load * SCHED_POWER_SCALE) / group->sgp->power; + avg_load = (avg_load * SCHED_POWER_SCALE) + / group->sgp->power_available; if (local_group) { this_load = avg_load; @@ -3551,10 +3552,10 @@ static int get_cpu_activity(int cpu) if (sum == period) { u32 overload = rq->nr_running > 1 ? 1 : 0; - return power_of(cpu) + overload; + return available_of(cpu) + overload; } - return (sum * power_of(cpu)) / period; + return (sum * available_of(cpu)) / period; } /* @@ -4596,8 +4597,12 @@ static void update_cpu_power(struct sched_domain *sd, int cpu) cpu_rq(cpu)->cpu_available = power; sdg->sgp->power_available = power; + if (!is_my_buddy(cpu, cpu)) + power = 1; + cpu_rq(cpu)->cpu_power = power; sdg->sgp->power = power; + } void update_group_power(struct sched_domain *sd, int cpu)