Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp4292778imm; Wed, 30 May 2018 02:55:14 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJ9sVZYzbthmg/sI+zKG6Xkws04aTsD5oUYNDzruxKq4/Lpotkso6hyTaSKeRunbXPvXQX8 X-Received: by 2002:a63:a44a:: with SMTP id c10-v6mr1669691pgp.198.1527674114046; Wed, 30 May 2018 02:55:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527674114; cv=none; d=google.com; s=arc-20160816; b=dXbrHGBBIz61G4wau2R2SeY2aaqBGB2JBMMKokxW+2cyYHTv63l9/mV6WFM9ZInwYF DmDyLrjKfNKcvp4BAdEYDzs/ntRrx+Ca0D8kHiQrogIiCGMH7ATSdpJRWWM5v57b7680 xrnfH7MpgVdEduYk04869vfHynvE/2/2mK7Lm+n7f9qVg5vzr8HwsSMJUQbQmlWnR3YE SsjRrv1/6bV1GkBbOrL4UoB27zn5Ziaq/xJMjAx/o0l6PTac1pbpzIuGNtI1wfwhzlD1 nh61eXKbUGTOMH0SeM1DXy4RNxXClEQMs4tOhlKX0ZcFW3MtQtLWOxVen6aoyhGqPuXV /L0A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=bO/yshmK6s3ua7MIBQCXCQ5iSpUu03T4j8tbbISMuSE=; b=DLXWZblJWGaWwzxdVcIqoQ7qJmcDAgOxAr8msIGDTx1uOZmTfRcFuKF8P24x+ou7tA WwB8s3u4WP2cLgit4l+C5Z2o0tbMRJuh+3ppRA1fyh35pEjT8suEqrHbVbyGFnpm/1Pe SdCS0Ca7uL/o2SuTrUOnkkBGL1zZA2aJm+bjsISFrkwFvIEwxG0pbRAD+ZSkh0YYGmyU mg/ozsTOAnbznRPAqQbkKPHZSmKmDy3uputVCp8FvyCAR0KLgJrCIHfZSBfrqxRvWHrb jmEKoD2+77yU+2aZSqxuzFjPnwXLcgAbp0kp8W97/ptR4eKm3uH9POUrBomAeTwyZ4ZA N5JQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=f/Iv4TEY; 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 w66-v6si35431802pfj.144.2018.05.30.02.55.00; Wed, 30 May 2018 02:55:14 -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=f/Iv4TEY; 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 S1751730AbeE3JyJ (ORCPT + 99 others); Wed, 30 May 2018 05:54:09 -0400 Received: from mail-io0-f194.google.com ([209.85.223.194]:35537 "EHLO mail-io0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750869AbeE3JyH (ORCPT ); Wed, 30 May 2018 05:54:07 -0400 Received: by mail-io0-f194.google.com with SMTP id g1-v6so20927328iob.2 for ; Wed, 30 May 2018 02:54:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=bO/yshmK6s3ua7MIBQCXCQ5iSpUu03T4j8tbbISMuSE=; b=f/Iv4TEYLzjzrQhW9nlsYj02WfDmp9+tPx4932S+3x+ivbM2QtTkJQA4BxqVXJJ2mT xVvkQT+TbkJlwy01M1sbpdqQp2xdJ7sAXSXxgWozLXkhkOIilpL2Vw0aKsoVnp39ot2/ 5mJTvnuRX0mDQcOlP5ftfb/lAAr5zAsHEYnFo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=bO/yshmK6s3ua7MIBQCXCQ5iSpUu03T4j8tbbISMuSE=; b=NrPHaTzOQKlKIgYeV0mutBls/QYKcf0Nw/id1d9nxAz+wShXvf3dFAvmV9NyT0Yfsp 9mf8jeTKMQwYO2QKPlJzbSPfwmcjSVaG3vhRt8LZwfkK59VmwtqR6txDOQT+EvTpXpzV kol8vee1GWWNjlEyE8se7W49bHlLsbK/uSR1zAOYlMBzC3m7swHq0ZNjcxVMvb2u/KSf l+p2muOF5Redid5AKByCTbKrBuMxENqnrVoipX6hbtcHqr0Xeo9p2cVosnehYleFxgJq DauOpeHPAMSMtHO6fPFwlenWhuHke3ktJXKoyYIg3mbegnJcZ+cVKuyJ+T008YlG+Wlz AOOg== X-Gm-Message-State: APt69E1m1rO8aDQDunmcgUMWOg71/6prcVuNNUADdWLZ01cge9a8LS8t H76+fWYR1wdddIoJBPhtWUvrvrlcBln0LCOYxAES8Q== X-Received: by 2002:a6b:c88c:: with SMTP id y134-v6mr1530818iof.295.1527674046940; Wed, 30 May 2018 02:54:06 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a6b:4cc:0:0:0:0:0 with HTTP; Wed, 30 May 2018 02:53:46 -0700 (PDT) In-Reply-To: <20180530094001.GH30654@e110439-lin> References: <1527253951-22709-1-git-send-email-vincent.guittot@linaro.org> <1527253951-22709-4-git-send-email-vincent.guittot@linaro.org> <20180530094001.GH30654@e110439-lin> From: Vincent Guittot Date: Wed, 30 May 2018 11:53:46 +0200 Message-ID: Subject: Re: [PATCH v5 03/10] cpufreq/schedutil: add rt utilization tracking To: Patrick Bellasi Cc: Peter Zijlstra , Ingo Molnar , linux-kernel , "Rafael J. Wysocki" , Juri Lelli , Dietmar Eggemann , Morten Rasmussen , viresh kumar , Valentin Schneider , Quentin Perret Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 30 May 2018 at 11:40, Patrick Bellasi wrote: > On 25-May 15:12, Vincent Guittot wrote: >> Add both cfs and rt utilization when selecting an OPP for cfs tasks as rt >> can preempt and steal cfs's running time. >> >> Signed-off-by: Vincent Guittot >> --- >> kernel/sched/cpufreq_schedutil.c | 14 +++++++++++--- >> 1 file changed, 11 insertions(+), 3 deletions(-) >> >> diff --git a/kernel/sched/cpufreq_schedutil.c b/kernel/sched/cpufreq_schedutil.c >> index 28592b6..a84b5a5 100644 >> --- a/kernel/sched/cpufreq_schedutil.c >> +++ b/kernel/sched/cpufreq_schedutil.c >> @@ -56,6 +56,7 @@ struct sugov_cpu { >> /* The fields below are only needed when sharing a policy: */ >> unsigned long util_cfs; >> unsigned long util_dl; >> + unsigned long util_rt; >> unsigned long max; >> >> /* The field below is for single-CPU policies only: */ >> @@ -178,14 +179,21 @@ static void sugov_get_util(struct sugov_cpu *sg_cpu) >> sg_cpu->max = arch_scale_cpu_capacity(NULL, sg_cpu->cpu); >> sg_cpu->util_cfs = cpu_util_cfs(rq); >> sg_cpu->util_dl = cpu_util_dl(rq); >> + sg_cpu->util_rt = cpu_util_rt(rq); >> } >> >> static unsigned long sugov_aggregate_util(struct sugov_cpu *sg_cpu) >> { >> struct rq *rq = cpu_rq(sg_cpu->cpu); >> + unsigned long util; >> >> - if (rq->rt.rt_nr_running) >> - return sg_cpu->max; >> + if (rq->rt.rt_nr_running) { >> + util = sg_cpu->max; > > Why not just adding the following lines while keeping the return in > for the rq->rt.rt_nr_running case? > >> + } else { >> + util = sg_cpu->util_dl; >> + util += sg_cpu->util_cfs; >> + util += sg_cpu->util_rt; >> + } >> >> /* >> * Utilization required by DEADLINE must always be granted while, for >> @@ -197,7 +205,7 @@ static unsigned long sugov_aggregate_util(struct sugov_cpu *sg_cpu) >> * util_cfs + util_dl as requested freq. However, cpufreq is not yet >> * ready for such an interface. So, we only do the latter for now. >> */ >> - return min(sg_cpu->max, (sg_cpu->util_dl + sg_cpu->util_cfs)); >> + return min(sg_cpu->max, util); > > ... for the rq->rt.rt_nr_running case we don't really need to min > clamp util = sg_cpu->max with itself... yes good point > >> } >> >> static void sugov_set_iowait_boost(struct sugov_cpu *sg_cpu, u64 time, unsigned int flags) >> -- >> 2.7.4 >> > > -- > #include > > Patrick Bellasi