From patchwork Wed Sep 24 17:48:15 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dietmar Eggemann X-Patchwork-Id: 37864 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lb0-f197.google.com (mail-lb0-f197.google.com [209.85.217.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 4DA60202FD for ; Wed, 24 Sep 2014 17:48:07 +0000 (UTC) Received: by mail-lb0-f197.google.com with SMTP id l4sf5681892lbv.0 for ; Wed, 24 Sep 2014 10:48:06 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:message-id:date:from:user-agent :mime-version:to:cc:subject:references:in-reply-to:sender:precedence :list-id:x-original-sender:x-original-authentication-results :mailing-list:list-post:list-help:list-archive:list-unsubscribe :content-type:content-transfer-encoding; bh=dQvjgWj4jxzHuweD54+Aa1SKBu660fi+zKMNsTmuvUs=; b=Cyihl94N8PI/0hrOiwTkQUeFT8HLmXB40HoJM7Z821wGek41xiMMnQ2OFutD0yUkqH Cyci2j4ZLo48pM4dU3EKkzdiaXE1EVKUiom41AHtKVvRBRv2WYVWSyESTzZK4vx6k9mN 1erwNQh0j32UCn27+JqXaMTKUxnKk2GuGECrhOvtccMR8NM2Wc1fwkBgeSU74wUMe+QJ 7wL/tOn5GM+5PfhD/lI0QyhNyDENbVYXfFCEUcHa6SeeN7mRHZ7sjJqSsCp7NWbuqv+b 5fXbxkBf3QqFfCSNEl4DlHGR4pQOexdBFAvKYfFSj5qjWesCjszcTLo4jiA7wP/ad/uj GFeg== X-Gm-Message-State: ALoCoQlYsINDjCSDK7NmrVyjmalLUpgnN4CAbeF+N2ng8u/Zifn95hJbkEELNwlKq+z8hHE6dhh0 X-Received: by 10.112.149.67 with SMTP id ty3mr1258418lbb.1.1411580885974; Wed, 24 Sep 2014 10:48:05 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.205.104 with SMTP id lf8ls162520lac.87.gmail; Wed, 24 Sep 2014 10:48:05 -0700 (PDT) X-Received: by 10.152.205.9 with SMTP id lc9mr8139357lac.34.1411580885667; Wed, 24 Sep 2014 10:48:05 -0700 (PDT) Received: from mail-la0-f42.google.com (mail-la0-f42.google.com [209.85.215.42]) by mx.google.com with ESMTPS id q5si23760609laq.60.2014.09.24.10.48.05 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 24 Sep 2014 10:48:05 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.42 as permitted sender) client-ip=209.85.215.42; Received: by mail-la0-f42.google.com with SMTP id hz20so11228122lab.15 for ; Wed, 24 Sep 2014 10:48:05 -0700 (PDT) X-Received: by 10.112.75.233 with SMTP id f9mr4396756lbw.102.1411580885289; Wed, 24 Sep 2014 10:48:05 -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.112.130.169 with SMTP id of9csp625959lbb; Wed, 24 Sep 2014 10:48:04 -0700 (PDT) X-Received: by 10.68.197.170 with SMTP id iv10mr10963027pbc.129.1411580883603; Wed, 24 Sep 2014 10:48:03 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r1si27365689pdl.121.2014.09.24.10.48.02 for ; Wed, 24 Sep 2014 10:48:03 -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 S1753006AbaIXRsA (ORCPT + 27 others); Wed, 24 Sep 2014 13:48:00 -0400 Received: from service87.mimecast.com ([91.220.42.44]:48990 "EHLO service87.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751237AbaIXRr6 convert rfc822-to-8bit (ORCPT ); Wed, 24 Sep 2014 13:47:58 -0400 Received: from cam-owa1.Emea.Arm.com (fw-tnat.cambridge.arm.com [217.140.96.21]) by service87.mimecast.com; Wed, 24 Sep 2014 18:47:55 +0100 Received: from [10.1.197.159] ([10.1.255.212]) by cam-owa1.Emea.Arm.com with Microsoft SMTPSVC(6.0.3790.3959); Wed, 24 Sep 2014 18:47:53 +0100 Message-ID: <542303DF.8010606@arm.com> Date: Wed, 24 Sep 2014 18:48:15 +0100 From: Dietmar Eggemann User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.0 MIME-Version: 1.0 To: Vincent Guittot , "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 , "efault@gmx.de" , "nicolas.pitre@linaro.org" , "linaro-kernel@lists.linaro.org" , "daniel.lezcano@linaro.org" , "pjt@google.com" , "bsegall@google.com" Subject: Re: [PATCH v6 5/6] sched: replace capacity_factor by usage References: <1411488485-10025-1-git-send-email-vincent.guittot@linaro.org> <1411488485-10025-6-git-send-email-vincent.guittot@linaro.org> In-Reply-To: <1411488485-10025-6-git-send-email-vincent.guittot@linaro.org> X-OriginalArrivalTime: 24 Sep 2014 17:47:53.0245 (UTC) FILETIME=[AA758CD0:01CFD81F] X-MC-Unique: 114092418475509101 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: dietmar.eggemann@arm.com X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.42 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: , On 23/09/14 17:08, Vincent Guittot wrote: [...] > > Finally, the sched_group->sched_group_capacity->capacity_orig has been removed > because it's more used during load balance. So you're not forced to call it rq->cpu_capacity_orig any more, you could use rq->cpu_capacity_max instead. [...] This review (by PeterZ) during v5 of your patch-set recommended some renaming (e.g. s/group_has_free_capacity/group_has_capacity and s/group_out_of_capacity/group_no_capacity as well as reordering of the parameters which I agree with: https://lkml.org/lkml/2014/9/11/706 > > -/* > - * Compute the group capacity factor. > - * > - * Avoid the issue where N*frac(smt_capacity) >= 1 creates 'phantom' cores by > - * first dividing out the smt factor and computing the actual number of cores > - * and limit unit capacity with that. > - */ > -static inline int sg_capacity_factor(struct lb_env *env, struct sched_group *group) > +static inline int group_has_free_capacity(struct sg_lb_stats *sgs, s/static inline int/static inline bool > + struct lb_env *env) > { > - unsigned int capacity_factor, smt, cpus; > - unsigned int capacity, capacity_orig; > + if ((sgs->group_capacity * 100) > > + (sgs->group_usage * env->sd->imbalance_pct)) > + return true; > > - capacity = group->sgc->capacity; > - capacity_orig = group->sgc->capacity_orig; > - cpus = group->group_weight; > + if (sgs->sum_nr_running < sgs->group_weight) > + return true; > > - /* smt := ceil(cpus / capacity), assumes: 1 < smt_capacity < 2 */ > - smt = DIV_ROUND_UP(SCHED_CAPACITY_SCALE * cpus, capacity_orig); > - capacity_factor = cpus / smt; /* cores */ > + return false; > +} > > - capacity_factor = min_t(unsigned, > - capacity_factor, DIV_ROUND_CLOSEST(capacity, SCHED_CAPACITY_SCALE)); > - if (!capacity_factor) > - capacity_factor = fix_small_capacity(env->sd, group); > +static inline int group_is_overloaded(struct sg_lb_stats *sgs, s/static inline int/static inline bool > + struct lb_env *env) > +{ > + if (sgs->sum_nr_running <= sgs->group_weight) > + return false; > > - return capacity_factor; > + if ((sgs->group_capacity * 100) < > + (sgs->group_usage * env->sd->imbalance_pct)) > + return true; > + > + return false; > } > > static enum group_type > -group_classify(struct sched_group *group, struct sg_lb_stats *sgs) > +group_classify(struct sched_group *group, struct sg_lb_stats *sgs, > + struct lb_env *env) > { > - if (sgs->sum_nr_running > sgs->group_capacity_factor) > + if (group_is_overloaded(sgs, env)) > return group_overloaded; > > if (sg_imbalanced(group)) > @@ -6072,11 +6038,10 @@ static inline void update_sg_lb_stats(struct lb_env *env, > sgs->load_per_task = sgs->sum_weighted_load / sgs->sum_nr_running; > > sgs->group_weight = group->group_weight; > - sgs->group_capacity_factor = sg_capacity_factor(env, group); > - sgs->group_type = group_classify(group, sgs); > > - if (sgs->group_capacity_factor > sgs->sum_nr_running) > - sgs->group_has_free_capacity = 1; > + sgs->group_type = group_classify(group, sgs, env); > + > + sgs->group_out_of_capacity = group_is_overloaded(sgs, env); In case sgs->group_type is group_overloaded you could set sgs->group_out_of_capacity to 1 without calling group_is_overloaded again. > } > > /** > @@ -6198,17 +6163,21 @@ static inline void update_sd_lb_stats(struct lb_env *env, struct sd_lb_stats *sd [...] --- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/ diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index 7cdf271e8e52..52d441c92a4f 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -6037,7 +6037,8 @@ static inline void update_sg_lb_stats(struct lb_env *env, sgs->group_type = group_classify(group, sgs, env); - sgs->group_out_of_capacity = group_is_overloaded(sgs, env); + if (sgs->group_type == group_overloaded) + sgs->group_out_of_capacity = 1; }