From patchwork Fri Oct 18 11:52:19 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vincent Guittot X-Patchwork-Id: 21119 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-yh0-f69.google.com (mail-yh0-f69.google.com [209.85.213.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id B4818246F1 for ; Fri, 18 Oct 2013 11:53:53 +0000 (UTC) Received: by mail-yh0-f69.google.com with SMTP id v1sf7570397yhn.4 for ; Fri, 18 Oct 2013 04:53:53 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=mime-version:x-gm-message-state:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-unsubscribe; bh=wH03PJEDGWU9IWCzm5dJt6W0vqHBycHVjA1/FoXNHaE=; b=N+ocldPbzcdmop4AxM86rH3VdyfArHMWayMHP+PPEsFbGrZwgbwSO2cysgypEavXBm I37ZUbFoN1FiQGt5H4/jpwHJQeSeKhZtd7eA0SW9dwHkD3CMi7Ze5KUY3BpzNLcVadke aq3GpYLWG8vKhsN0569ODBEqWrgQetfrSs04KSecnM+fYiOuC9ypPX+CIkg4eBk15+Z2 RiOwl0C1A/SF0TQg+VQX/7chs4DDR9btxcahxOnWFkWE53C3lK/Rfcsk3fUShOHUWkXR dusJAOsjLU/OBQYKe93FnrSOEGDpBNgqQVK+PkIEMBD4IW4jcIxosrg/LoDVA4kBFSOS aoPg== X-Received: by 10.236.80.42 with SMTP id j30mr2345555yhe.29.1382097233396; Fri, 18 Oct 2013 04:53:53 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.15.198 with SMTP id z6ls1229595qec.63.gmail; Fri, 18 Oct 2013 04:53:53 -0700 (PDT) X-Received: by 10.52.22.110 with SMTP id c14mr46464vdf.28.1382097233195; Fri, 18 Oct 2013 04:53:53 -0700 (PDT) Received: from mail-vb0-f45.google.com (mail-vb0-f45.google.com [209.85.212.45]) by mx.google.com with ESMTPS id k10si225251vca.124.2013.10.18.04.53.53 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 18 Oct 2013 04:53:53 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.212.45 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.212.45; Received: by mail-vb0-f45.google.com with SMTP id e15so1748603vbg.4 for ; Fri, 18 Oct 2013 04:53:53 -0700 (PDT) X-Gm-Message-State: ALoCoQkwPRVEH53E5BIH4iFGgKld0ekZv8nF/w4lt4tUy1Zki5l6JjvzxkqOzcfpVpwc+zG7RrUL X-Received: by 10.52.118.98 with SMTP id kl2mr24443vdb.30.1382097233103; Fri, 18 Oct 2013 04:53:53 -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.220.174.196 with SMTP id u4csp29483vcz; Fri, 18 Oct 2013 04:53:52 -0700 (PDT) X-Received: by 10.180.182.82 with SMTP id ec18mr2105705wic.13.1382097232086; Fri, 18 Oct 2013 04:53:52 -0700 (PDT) Received: from mail-we0-f177.google.com (mail-we0-f177.google.com [74.125.82.177]) by mx.google.com with ESMTPS id jo9si415184wjc.114.2013.10.18.04.53.51 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 18 Oct 2013 04:53:51 -0700 (PDT) Received-SPF: neutral (google.com: 74.125.82.177 is neither permitted nor denied by best guess record for domain of vincent.guittot@linaro.org) client-ip=74.125.82.177; Received: by mail-we0-f177.google.com with SMTP id x55so3591548wes.22 for ; Fri, 18 Oct 2013 04:53:50 -0700 (PDT) X-Received: by 10.194.222.2 with SMTP id qi2mr2305674wjc.14.1382097230804; Fri, 18 Oct 2013 04:53:50 -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 lr3sm25000673wic.5.2013.10.18.04.53.49 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 18 Oct 2013 04:53:50 -0700 (PDT) From: Vincent Guittot To: linux-kernel@vger.kernel.org, peterz@infradead.org, mingo@kernel.org, pjt@google.com, Morten.Rasmussen@arm.com, cmetcalf@tilera.com, tony.luck@intel.com, alex.shi@intel.com, preeti@linux.vnet.ibm.com, linaro-kernel@lists.linaro.org Cc: rjw@sisk.pl, paulmck@linux.vnet.ibm.com, corbet@lwn.net, tglx@linutronix.de, len.brown@intel.com, arjan@linux.intel.com, amit.kucheria@linaro.org, l.majewski@samsung.com, Vincent Guittot Subject: [RFC][PATCH v5 06/14] sched: create a new field with available capacity Date: Fri, 18 Oct 2013 13:52:19 +0200 Message-Id: <1382097147-30088-6-git-send-email-vincent.guittot@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1382097147-30088-1-git-send-email-vincent.guittot@linaro.org> References: <1382097147-30088-1-git-send-email-vincent.guittot@linaro.org> X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: vincent.guittot@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.212.45 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: , This new field power_available reflects the available capacity of a CPU unlike the cpu_power which reflects the current capacity. Signed-off-by: Vincent Guittot --- kernel/sched/fair.c | 14 +++++++++++--- kernel/sched/sched.h | 3 ++- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index 5568980..db9b871 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -4584,15 +4584,19 @@ static void update_cpu_power(struct sched_domain *sd, int cpu) if (!power) power = 1; + cpu_rq(cpu)->cpu_available = power; + sdg->sgp->power_available = power; + cpu_rq(cpu)->cpu_power = power; sdg->sgp->power = power; + } void update_group_power(struct sched_domain *sd, int cpu) { struct sched_domain *child = sd->child; struct sched_group *group, *sdg = sd->groups; - unsigned long power; + unsigned long power, available; unsigned long interval; interval = msecs_to_jiffies(sd->balance_interval); @@ -4604,7 +4608,7 @@ void update_group_power(struct sched_domain *sd, int cpu) return; } - power = 0; + power = available = 0; if (child->flags & SD_OVERLAP) { /* @@ -4614,6 +4618,8 @@ void update_group_power(struct sched_domain *sd, int cpu) for_each_cpu(cpu, sched_group_cpus(sdg)) power += power_of(cpu); + available += available_of(cpu); + } else { /* * !SD_OVERLAP domains can assume that child groups @@ -4623,11 +4629,13 @@ void update_group_power(struct sched_domain *sd, int cpu) group = child->groups; do { power += group->sgp->power; + available += group->sgp->power_available; group = group->next; } while (group != child->groups); } - sdg->sgp->power_orig = sdg->sgp->power = power; + sdg->sgp->power_orig = sdg->sgp->power_available = available; + sdg->sgp->power = power; } /* diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h index 22e3f1d..d5a4ec0 100644 --- a/kernel/sched/sched.h +++ b/kernel/sched/sched.h @@ -459,6 +459,7 @@ struct rq { struct sched_domain *sd; unsigned long cpu_power; + unsigned long cpu_available; unsigned char idle_balance; /* For active balancing */ @@ -603,7 +604,7 @@ struct sched_group_power { * CPU power of this group, SCHED_LOAD_SCALE being max power for a * single CPU. */ - unsigned int power, power_orig; + unsigned int power, power_orig, power_available; unsigned long next_update; /* * Number of busy cpus in this group.