From patchwork Mon Jul 28 17:51:38 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vincent Guittot X-Patchwork-Id: 34396 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-oi0-f70.google.com (mail-oi0-f70.google.com [209.85.218.70]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id C8C61202E4 for ; Mon, 28 Jul 2014 17:55:12 +0000 (UTC) Received: by mail-oi0-f70.google.com with SMTP id u20sf40549662oif.1 for ; Mon, 28 Jul 2014 10:55:12 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:sender:precedence:list-id :x-original-sender:x-original-authentication-results:mailing-list :list-post:list-help:list-archive:list-unsubscribe; bh=Bj8zGzTkWg8fCRZFV6z98E9kIScKT65vSGhoDtERxmo=; b=IFZVpGb1ph/sBZhUIRWsuy1g/FHm1moxYE+13G0vpEzOTWUXkks+4holk7NICr/MpQ xlJ/SDFSekwTylIn3b9MROv/K/wyoszGMt/FGUE8bihlkNdpOGBdQMFiBjlVH3rQgc4z rVOn34EGJk3hnOdPCEgyyq6/ziKxgcnP3dwXB50YbO7h3gBkf96q+gQnJlKZb0Tr3Qvr TijUOUXelffDXLLCk4CJiDnJrLARjq4lWmMkGysW7MpWOsadnwwK1jBOSV9n/xA5cSyN kWPtNo4P3pkNRG7Y/+sMa5pyR3FtamFPDOxyi8aXXXFEZzg5xkW3Fb0J95D0o5HpgMxc TeGg== X-Gm-Message-State: ALoCoQmraXiT6rOP4iLojW/98e4DB09YVIO1POJLITuhIyv0ygGZVnYtiUdSYJAfv+JkTFY+UKMF X-Received: by 10.182.4.73 with SMTP id i9mr8128082obi.28.1406570112254; Mon, 28 Jul 2014 10:55:12 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.96.38 with SMTP id j35ls2143557qge.89.gmail; Mon, 28 Jul 2014 10:55:12 -0700 (PDT) X-Received: by 10.220.5.1 with SMTP id 1mr2499821vct.73.1406570112138; Mon, 28 Jul 2014 10:55:12 -0700 (PDT) Received: from mail-vc0-f180.google.com (mail-vc0-f180.google.com [209.85.220.180]) by mx.google.com with ESMTPS id ha4si13012494veb.1.2014.07.28.10.55.12 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 28 Jul 2014 10:55:12 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.180 as permitted sender) client-ip=209.85.220.180; Received: by mail-vc0-f180.google.com with SMTP id ij19so11497330vcb.25 for ; Mon, 28 Jul 2014 10:55:12 -0700 (PDT) X-Received: by 10.220.118.136 with SMTP id v8mr2525423vcq.50.1406570112017; Mon, 28 Jul 2014 10:55:12 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.221.37.5 with SMTP id tc5csp185994vcb; Mon, 28 Jul 2014 10:55:08 -0700 (PDT) X-Received: by 10.66.231.139 with SMTP id tg11mr40528396pac.87.1406570045723; Mon, 28 Jul 2014 10:54:05 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id qc2si9288155pdb.307.2014.07.28.10.54.04 for ; Mon, 28 Jul 2014 10:54:05 -0700 (PDT) Received-SPF: none (google.com: linux-kernel-owner@vger.kernel.org does not designate permitted sender hosts) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751809AbaG1RxF (ORCPT + 26 others); Mon, 28 Jul 2014 13:53:05 -0400 Received: from mail-wg0-f43.google.com ([74.125.82.43]:51860 "EHLO mail-wg0-f43.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751412AbaG1Rwr (ORCPT ); Mon, 28 Jul 2014 13:52:47 -0400 Received: by mail-wg0-f43.google.com with SMTP id l18so7559138wgh.14 for ; Mon, 28 Jul 2014 10:52:43 -0700 (PDT) X-Received: by 10.194.63.77 with SMTP id e13mr50789015wjs.104.1406569962965; Mon, 28 Jul 2014 10:52:42 -0700 (PDT) Received: from lmenx30s.lme.st.com (LPuteaux-656-01-48-212.w82-127.abo.wanadoo.fr. [82.127.83.212]) by mx.google.com with ESMTPSA id ex4sm33758149wic.2.2014.07.28.10.52.41 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 28 Jul 2014 10:52:42 -0700 (PDT) From: Vincent Guittot To: peterz@infradead.org, mingo@kernel.org, linux-kernel@vger.kernel.org, preeti@linux.vnet.ibm.com, linux@arm.linux.org.uk, linux-arm-kernel@lists.infradead.org Cc: riel@redhat.com, Morten.Rasmussen@arm.com, efault@gmx.de, nicolas.pitre@linaro.org, linaro-kernel@lists.linaro.org, daniel.lezcano@linaro.org, dietmar.eggemann@arm.com, Vincent Guittot Subject: [PATCH v4 04/12] sched: Allow all archs to set the capacity_orig Date: Mon, 28 Jul 2014 19:51:38 +0200 Message-Id: <1406569906-9763-5-git-send-email-vincent.guittot@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1406569906-9763-1-git-send-email-vincent.guittot@linaro.org> References: <1406569906-9763-1-git-send-email-vincent.guittot@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: vincent.guittot@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.180 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , capacity_orig is only changed for system with a SMT sched_domain level in order to reflect the lower capacity of CPUs. Heterogenous system also have to reflect an original capacity that is different from the default value. Create a more generic function arch_scale_cpu_capacity that can be also used by non SMT platform to set capacity_orig. The weak behavior of arch_scale_cpu_capacity is the previous SMT one in order to keep backward compatibility in the use of capacity_orig. arch_scale_smt_capacity and default_scale_smt_capacity have been removed as they were not use elsewhere than in arch_scale_cpu_capacity. Signed-off-by: Vincent Guittot --- kernel/sched/fair.c | 25 ++++++------------------- 1 file changed, 6 insertions(+), 19 deletions(-) diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index 647d0a6..00ff5f3 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -5642,19 +5642,12 @@ unsigned long __weak arch_scale_freq_capacity(struct sched_domain *sd, int cpu) return default_scale_capacity(sd, cpu); } -static unsigned long default_scale_smt_capacity(struct sched_domain *sd, int cpu) +unsigned long __weak arch_scale_cpu_capacity(struct sched_domain *sd, int cpu) { - unsigned long weight = sd->span_weight; - unsigned long smt_gain = sd->smt_gain; + if ((sd->flags & SD_SHARE_CPUCAPACITY) && (sd->span_weight > 1)) + return sd->smt_gain / sd->span_weight; - smt_gain /= weight; - - return smt_gain; -} - -unsigned long __weak arch_scale_smt_capacity(struct sched_domain *sd, int cpu) -{ - return default_scale_smt_capacity(sd, cpu); + return SCHED_CAPACITY_SCALE; } static unsigned long scale_rt_capacity(int cpu) @@ -5693,18 +5686,12 @@ static unsigned long scale_rt_capacity(int cpu) static void update_cpu_capacity(struct sched_domain *sd, int cpu) { - unsigned long weight = sd->span_weight; unsigned long capacity = SCHED_CAPACITY_SCALE; struct sched_group *sdg = sd->groups; - if ((sd->flags & SD_SHARE_CPUCAPACITY) && weight > 1) { - if (sched_feat(ARCH_CAPACITY)) - capacity *= arch_scale_smt_capacity(sd, cpu); - else - capacity *= default_scale_smt_capacity(sd, cpu); + capacity *= arch_scale_cpu_capacity(sd, cpu); - capacity >>= SCHED_CAPACITY_SHIFT; - } + capacity >>= SCHED_CAPACITY_SHIFT; sdg->sgc->capacity_orig = capacity;