Received: by 10.192.165.156 with SMTP id m28csp1623207imm; Thu, 12 Apr 2018 00:06:54 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/sI66tiC4ghPmbAV+Mm1ismAbsCF2oLJRrEKvUQaWcJfc8Zk3TQIw2qMuvzrcvPtAglghB X-Received: by 10.98.141.78 with SMTP id z75mr6717645pfd.174.1523516814481; Thu, 12 Apr 2018 00:06:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523516814; cv=none; d=google.com; s=arc-20160816; b=01n+iSkdp9DFtdxynBRKZBv0E9+jtf+2hRBL2LBnGB12PKLBQ089Y3jHOiBg+k9J3A xAbBbJofQh188PCV9PA5oBgEW/GjVv205kJHBk4DGYWZ1zb0IWSVKaSacO/HPJ3gDd+B aP0jQ9XSgy8vh7hi1zn9NNy3nkMXwZ3OR5zNEwGLdxfOh90tnBLCTClfbx1OMLu7nctb Q0svEIvRQUFZYFA4OSC2arIRwp7eJ4tq18hOAc/ueulNTt8iqQUV+EwYFtOjwUFEI4qD W6HaqWdIhu9tL+sYYIyY/9s5QiId8I2+E21P8T57jAMZCqOvDBd7kSsC/8JLS4r+KojD yHIQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:arc-authentication-results; bh=Z/ZBE/6tKSk+2eBVs5Its+JcXKLbHBvstLYmzWKMl6U=; b=C0U0ujQaUKAcmPuL45+poyOKxQeV3feWidrqmJzJakT0a9fLLpW3EM0wqWQWX16Uys PwSnW5kTUy3UEuORFYvnfYt6wsu5FrOilQdChljY3lqcKRSqLO9duzLjbN10rkadF3es B+SBdQBYm01fgQr77g7rihyFSODhi3RAQz1qZtW+QsMMy5UDgk1tq59zGY/Dj/25MAcK T7TyRIXqczl9b3GMVqRhyM7dbgA9pdOr44YsPYzCbmdNtUzaWKIk5c7w6UpE33QhoV4u H02cCyEiRDLzgg73a66ZOxtn9qd94CbfIFhQaYjrv0xGVJhTQQ+xEj731JhA6ELl4I8O iyqA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Eh8VKYVa; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r17si2085371pfh.15.2018.04.12.00.06.16; Thu, 12 Apr 2018 00:06:54 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Eh8VKYVa; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752955AbeDLHCg (ORCPT + 99 others); Thu, 12 Apr 2018 03:02:36 -0400 Received: from mail-pf0-f195.google.com ([209.85.192.195]:42786 "EHLO mail-pf0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752936AbeDLHCe (ORCPT ); Thu, 12 Apr 2018 03:02:34 -0400 Received: by mail-pf0-f195.google.com with SMTP id o16so2860966pfk.9 for ; Thu, 12 Apr 2018 00:02:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=Z/ZBE/6tKSk+2eBVs5Its+JcXKLbHBvstLYmzWKMl6U=; b=Eh8VKYVavSVeFU1OwxyzaLF+xGCLRD2wgAJ9JQ2dnZ7yWZzbm79m3/OcrtMex7ACJa 7pW/fHo5mGw66APj/tbYRUVOaZVmL/uXobJXOJ4FzJ+Z1OSlapmKZXq/A/fNBR0xzxTi P0akBfAiNwbi1VOKPBQWy9lNZzRey+QYIjgJw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=Z/ZBE/6tKSk+2eBVs5Its+JcXKLbHBvstLYmzWKMl6U=; b=gd2YzWB3KItr8apYrYkNQL+6lmPSKBSF2Dcfpbg4gz1a79ywWsSOukHM2a4ZQjz1ew jUj395FffYmqFw8jOAx5VsfhKN04j6autwI5o+4sIA/dhI5Kw7pok3M+m6THh8zukPPS /41ZRrnBEyRgypj/luyPf4M8xpLPs67bw/1m+HepQcoI3wRjXz5zUbMvVOR8rKS5wpN2 KTHSGyzz6cqNjhl3EjQXKBYY0EBcxXsblqy5dbxn/IR/onplPewRl2x1NrlAM7k/unUe 781R5VOy+P98suHUOMeark5r2mqDdIiuS7I4soMbNUrFR66aHX9CiVQGaf20EVE7Py2Y V5fg== X-Gm-Message-State: ALQs6tD6dsu459hz6ab74EehH/BJQ8nR4wn+0fzeykoIZnEDFCRgc08J bLAKWVDf+GVHj3G9LoCtC64H0A== X-Received: by 10.99.38.66 with SMTP id m63mr5856729pgm.164.1523516553486; Thu, 12 Apr 2018 00:02:33 -0700 (PDT) Received: from localhost ([122.171.228.188]) by smtp.gmail.com with ESMTPSA id k78sm8305589pfk.111.2018.04.12.00.02.32 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 12 Apr 2018 00:02:32 -0700 (PDT) Date: Thu, 12 Apr 2018 12:32:30 +0530 From: Viresh Kumar To: Dietmar Eggemann Cc: linux-kernel@vger.kernel.org, Peter Zijlstra , Quentin Perret , Thara Gopinath , linux-pm@vger.kernel.org, Morten Rasmussen , Chris Redpath , Patrick Bellasi , Valentin Schneider , "Rafael J . Wysocki" , Greg Kroah-Hartman , Vincent Guittot , Todd Kjos , Joel Fernandes , Juri Lelli , Steve Muckle , Eduardo Valentin Subject: Re: [RFC PATCH v2 1/6] sched/fair: Create util_fits_capacity() Message-ID: <20180412070230.GV7671@vireshk-i7> References: <20180406153607.17815-1-dietmar.eggemann@arm.com> <20180406153607.17815-2-dietmar.eggemann@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180406153607.17815-2-dietmar.eggemann@arm.com> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 06-04-18, 16:36, Dietmar Eggemann wrote: > The functionality that a given utilization fits into a given capacity > is factored out into a separate function. > > Currently it is only used in wake_cap() but will be re-used to figure > out if a cpu or a scheduler group is over-utilized. > > Cc: Ingo Molnar > Cc: Peter Zijlstra > Signed-off-by: Dietmar Eggemann > --- > kernel/sched/fair.c | 7 ++++++- > 1 file changed, 6 insertions(+), 1 deletion(-) > > diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c > index 0951d1c58d2f..0a76ad2ef022 100644 > --- a/kernel/sched/fair.c > +++ b/kernel/sched/fair.c > @@ -6574,6 +6574,11 @@ static unsigned long cpu_util_wake(int cpu, struct task_struct *p) > return min_t(unsigned long, util, capacity_orig_of(cpu)); > } > > +static inline int util_fits_capacity(unsigned long util, unsigned long capacity) > +{ > + return capacity * 1024 > util * capacity_margin; This changes the behavior slightly compared to existing code. If that wasn't intentional, perhaps you should use >= here. > +} > + > /* > * Disable WAKE_AFFINE in the case where task @p doesn't fit in the > * capacity of either the waking CPU @cpu or the previous CPU @prev_cpu. > @@ -6595,7 +6600,7 @@ static int wake_cap(struct task_struct *p, int cpu, int prev_cpu) > /* Bring task utilization in sync with prev_cpu */ > sync_entity_load_avg(&p->se); > > - return min_cap * 1024 < task_util(p) * capacity_margin; > + return !util_fits_capacity(task_util(p), min_cap); > } > > /* > -- > 2.11.0 -- viresh