Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp7527756ybi; Wed, 5 Jun 2019 19:57:27 -0700 (PDT) X-Google-Smtp-Source: APXvYqyYgtfczHB7C9p/xzHeZpD6b5AKbrsqAkdGxlYKwk2U8zRGadMZHLj7AisroISMvTUvFqkZ X-Received: by 2002:a63:2844:: with SMTP id o65mr1053925pgo.297.1559789847632; Wed, 05 Jun 2019 19:57:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559789847; cv=none; d=google.com; s=arc-20160816; b=xEhOkEvrHQOG6uOty+XKocZZkC4C4lp0n8JcS4MDy9EfbaaZny0M3XSo0qvra7O6S8 3pFKv0VbZAY6eFcL0dHoK5hinr5nYRaV4M1XfIL6MR1zV2Gv7GQFvUEdWyoNK+IEUidE IudnvX0xOVdRAcmStcLv2qhT8I8dO9rYiWMJJFgIlUcdI7W+aFkP7TlWOd1DHAEJZkBv 5Qy1KVWo8iUTRcym9kNMhtCJdaCpTVlU4W7R+cbCpU3p6vLGnAv7DZJ6iie/cEl6zGal AAwOpKfkR2coH01ClhK9v63kKtZiezd7wPLxPlJt47pzGFd6z8THb0Z+LTcV318fP+OR UgwA== 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; bh=7zLWmYl/+X2He6Ch7i6FSYueJhM5f4AH0Fhf/uNr4es=; b=q3seOvPo1JS1MyvzmJa1xwklBXuWlAXzuD8HRfd8G9eKnsoNr1NdyP46cJO9GOD+rU hyujtkce7FG5B4gmuaaHkHwyyuAXbpINLeCWyEZ6xXWw3wzpnNOjyuygVPc+ykoSiH0n Q18C0AJzzvl2AcTJA/zqzq9XMWg8vxLmfycdXy4Zq0q/Cl/wlaNP2hPRRLq1t79puBA2 8fSQeVUoohJtWXBxXEn/BciWJcWhVMS2H7VSIibL6mYZZIVV4ifVIDWovkJDqyYBQPnv rjcOi/XBj28/mbj+m9chqxw0Nkax/0bj+mNA4f2WR2tRm7UcSiUVovrlPxXgvRtVrtMa gY8g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="DFulL/R6"; 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 c145si511802pfb.9.2019.06.05.19.57.08; Wed, 05 Jun 2019 19:57:27 -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="DFulL/R6"; 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 S1726823AbfFFCyt (ORCPT + 99 others); Wed, 5 Jun 2019 22:54:49 -0400 Received: from mail-pf1-f194.google.com ([209.85.210.194]:46783 "EHLO mail-pf1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726806AbfFFCys (ORCPT ); Wed, 5 Jun 2019 22:54:48 -0400 Received: by mail-pf1-f194.google.com with SMTP id y11so517796pfm.13 for ; Wed, 05 Jun 2019 19:54:47 -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=7zLWmYl/+X2He6Ch7i6FSYueJhM5f4AH0Fhf/uNr4es=; b=DFulL/R680YF6KTZlZwzyLgEOuX5oX3pNweBw5PzqDFAKvuanRCLvVnv1F4/bjc41P vR49GnfeZgv+Tb1QEPvIQE78hQ6XwJmwCVAqlgvbyjTtgLAQxcpnBJGoD1uGTGvfi+B+ hoWhgfkNA5d3TaZpi8f4qiYkFVgSnPPOF7DgdfkVQnzF5T3OS0vFERVdB5BqBhsJSBFl 386Vn5XX4dObSbEDu/WSg3xU7D4NzGGyvaBIKdalcBl+p2Uj0BDKJYiVjditjL/FbShx Et1ReY0azsehYO8aUaH0bfRZViGiV7uD8AwDfBmu1CR5VHisjtQypVv/6cKMPdde6sC9 fe0Q== 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=7zLWmYl/+X2He6Ch7i6FSYueJhM5f4AH0Fhf/uNr4es=; b=iBuBfuMbr59GjU2eyCbYXl0JcMqS/tfdZE9/xvHc39a46kJgTWsF1auxp+mcLLFE+6 IuSBGr5cQUFtMw8R2hpj0GvZy16msBKqlmiYCBE+NYCwuXNblkXoZB0rPffZ764aTQqN 0KA1T3ro0OmhNg9iZsK3xMLTQ5SJ3WQr7uFtLmvM7+ceKXnoif9i9KhfYrqb85//KxMv IpUb8QJjEpDELmmhPigCkLlOmrMgDhWR9D5V52bKDnx+4En+wNT0Qeo11vuPA3YtYHUE qD4ERkyU1/cW2x6gBCkrUyJhW90OzroEGxV8QyM5ktzOuONFN3HfBOgS1E0/go5xfmmH ONcA== X-Gm-Message-State: APjAAAUAR8z3hWIArqyweKHt3KgSb1eZqj41RzTLYXdpasyfy05rIp2o eLhgqMZcqL5ttmsahFVAZ7pITQ== X-Received: by 2002:a62:750c:: with SMTP id q12mr29747379pfc.59.1559789687470; Wed, 05 Jun 2019 19:54:47 -0700 (PDT) Received: from localhost ([122.172.66.84]) by smtp.gmail.com with ESMTPSA id p7sm232322pgb.92.2019.06.05.19.54.46 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 05 Jun 2019 19:54:46 -0700 (PDT) Date: Thu, 6 Jun 2019 08:24:44 +0530 From: Viresh Kumar To: Peter Oskolkov Cc: Ingo Molnar , Peter Zijlstra , Linux Kernel Mailing List , Vincent Guittot Subject: Re: [PATCH] sched/fair: Introduce fits_capacity() Message-ID: <20190606025444.etxgxny6hosoa74z@vireshk-i7> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: NeoMutt/20180716-391-311a52 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 04-06-19, 08:59, Peter Oskolkov wrote: > On Tue, Jun 4, 2019 at 12:02 AM Viresh Kumar wrote: > > > > The same formula to check utilization against capacity (after > > considering capacity_margin) is already used at 5 different locations. > > > > This patch creates a new macro, fits_capacity(), which can be used from > > all these locations without exposing the details of it and hence > > simplify code. > > > > All the 5 code locations are updated as well to use it.. > > > > Signed-off-by: Viresh Kumar > > --- > > kernel/sched/fair.c | 14 +++++++------- > > 1 file changed, 7 insertions(+), 7 deletions(-) > > > > diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c > > index 7f8d477f90fe..db3a218b7928 100644 > > --- a/kernel/sched/fair.c > > +++ b/kernel/sched/fair.c > > @@ -102,6 +102,8 @@ int __weak arch_asym_cpu_priority(int cpu) > > * (default: ~20%) > > */ > > static unsigned int capacity_margin = 1280; > > + > > +#define fits_capacity(cap, max) ((cap) * capacity_margin < (max) * 1024) > > Any reason to have this as a macro and not as an inline function? I don't have any strong preference here, I used a macro as I didn't feel that type-checking is really required on the parameters and eventually this will get open coded anyway. Though I would be fine to make it a routine if maintainers want it that way. Thanks Peter. -- viresh