From patchwork Fri Mar 16 11:25:40 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vincent Guittot X-Patchwork-Id: 131921 Delivered-To: patch@linaro.org Received: by 10.46.84.17 with SMTP id i17csp618185ljb; Fri, 16 Mar 2018 04:26:40 -0700 (PDT) X-Google-Smtp-Source: AG47ELuh0ordGBosUHNBeDdALDQ+dvr6dVdwGvBVm5peJO0zlpmeUcg0qnrl6bKfjnefkWO1CHKU X-Received: by 2002:a17:902:7804:: with SMTP id p4-v6mr1771205pll.17.1521199600660; Fri, 16 Mar 2018 04:26:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521199600; cv=none; d=google.com; s=arc-20160816; b=crFmDQ7TG3/YY2RqTWwsUiGJ/rYd1flthW+MBWfJWsixD40PvESFBlN8ZFXejX1ATh h3wxAeqrhQ/9wsIRHWVj2HApeeFXxbjSy8NLhqI6mlH0RinIEP7N/Q3GM8VGlThyNbcc NwDRuEiKa657prWx1W84eAubBe7D0U6omipVs/PNQayOWKAhdzSwF0yIC9I6cQX8WMRw ypheTtmMr3KZv5+LyzLZEU+aTbD3cOvtXvKQsaXO0fNP7TtcvUrnITMRHSEK62n5tC1l YO0dgwGfjt1Fx6ZY1rIumAJH+DIHct41iOclqK4svOLXlQGcOmL1ancn4dpQqOdoZmk1 O31Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=Hl9dAOfDQW1Q9gueNRmv9XiQMKFH/X0jiwYD3A3LDY0=; b=LoqgJAYPkEROckMXc8cEk/JlzbVNzx0TWS3DYPbAkXzkKgJAz1copIJiW0S0dO13ap wZsR1MC8zrSeZPSR8/We0lwHECxw7zBPvKIdqn067gIFaww3lsfI4k87Ag4L4s8grbp4 irvImbde4vPd8eUssQYHhW+9hal10K1tJ50zIX21nRgOJldB2EnHMiX2ZOpAbLUTF7Qx MR627L7HknwpLQ1tCPalE4Ys7HwibF0JJwU1aKJy0z+a6LDPgxy59IknqZLdg0bEQ5A1 HIzJQTDYYZ65PVEAyx2HGZJ5tCENENC51vaxZ9RMIeOzKGH8sGQuJQHLIHlT2UkjFJuk m1Vg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=P4Tgv73u; 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 33-v6si5109684pls.491.2018.03.16.04.26.40; Fri, 16 Mar 2018 04:26:40 -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=P4Tgv73u; 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 S1753946AbeCPL0i (ORCPT + 28 others); Fri, 16 Mar 2018 07:26:38 -0400 Received: from mail-wm0-f66.google.com ([74.125.82.66]:55446 "EHLO mail-wm0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753884AbeCPLZ4 (ORCPT ); Fri, 16 Mar 2018 07:25:56 -0400 Received: by mail-wm0-f66.google.com with SMTP id q83so2386141wme.5 for ; Fri, 16 Mar 2018 04:25:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=Hl9dAOfDQW1Q9gueNRmv9XiQMKFH/X0jiwYD3A3LDY0=; b=P4Tgv73ud/p0yNEWTp+6j4YEObpYaazVsd/TNcGH30Sb691eIdi8Lzp6GmN3ZjxGcZ mLfjo+KsR4kMCIofZ5LmbzK0546Snl9qouDHD7og5yzU7MCPAs4Mzumh1UHja93WeRNZ JCXpMmzCq/mzge/xvslbg8pd5TiTY7uOM9ro0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=Hl9dAOfDQW1Q9gueNRmv9XiQMKFH/X0jiwYD3A3LDY0=; b=LjMohEQmZqDAlB3qJ8laewpcjxRWjPbCvmcc+Z50hO6rMXVKlvmKiSiJz3a5bRo+yZ WJP96x0p7VjogtQDyfCeiFYmHCg6WeFVioQj+bd3IjNdSiHMNEuCji42NtwE9tTKk7Dx NUdyGkfAbKCFhM7kDj1rsxOrsT3ggLVAEKHeVt1UxE6G0OtXt6XhZuVXOzCZ7WoGab95 FhHun+ep9QsR2vDNOf7xRPAB/AX4TpH/q5Ro6vQkj39PvbkKI29hflvrqRCKxwoKcpka xTrET9Eg093jyfk2KIzDotdmYlGoiTol6JNrwVAnnLN9MH811KDWd8LsAw2Kan885OXt tTWQ== X-Gm-Message-State: AElRT7FkfLGl08+LlTGSAHE7ELfErmF8jXZQ96XPTR3vAI8ehXzaqTsQ XsMXtK6OIZf7GNNI0Sij0cW6CQ== X-Received: by 10.28.109.90 with SMTP id i87mr1421598wmc.71.1521199554749; Fri, 16 Mar 2018 04:25:54 -0700 (PDT) Received: from localhost.localdomain ([2a01:e0a:f:6020:9471:2e09:99e5:f59]) by smtp.gmail.com with ESMTPSA id m15sm6785292wrb.58.2018.03.16.04.25.53 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 16 Mar 2018 04:25:54 -0700 (PDT) From: Vincent Guittot To: peterz@infradead.org, mingo@kernel.org, linux-kernel@vger.kernel.org, rjw@rjwysocki.net Cc: juri.lelli@redhat.com, dietmar.eggemann@arm.com, Morten.Rasmussen@arm.com, viresh.kumar@linaro.org, valentin.schneider@arm.com, Vincent Guittot Subject: [PATCH 3/4 v4] cpufreq/schedutil: add rt utilization tracking Date: Fri, 16 Mar 2018 12:25:40 +0100 Message-Id: <1521199541-15308-4-git-send-email-vincent.guittot@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1521199541-15308-1-git-send-email-vincent.guittot@linaro.org> References: <1521199541-15308-1-git-send-email-vincent.guittot@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org add both cfs and rt utilization when selecting an OPP as rt can preempt and steal cfs's running time Signed-off-by: Vincent Guittot --- kernel/sched/cpufreq_schedutil.c | 4 +++- kernel/sched/sched.h | 7 +++++++ 2 files changed, 10 insertions(+), 1 deletion(-) -- 2.7.4 diff --git a/kernel/sched/cpufreq_schedutil.c b/kernel/sched/cpufreq_schedutil.c index 89fe78e..7ce0643 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,6 +179,7 @@ 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) @@ -190,7 +192,7 @@ static unsigned long sugov_aggregate_util(struct sugov_cpu *sg_cpu) } else { util = sg_cpu->util_dl; if (rq->cfs.h_nr_running) - util += sg_cpu->util_cfs; + util += sg_cpu->util_cfs + sg_cpu->util_rt; } /* diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h index a8003a9..b8784be 100644 --- a/kernel/sched/sched.h +++ b/kernel/sched/sched.h @@ -2186,4 +2186,11 @@ static inline unsigned long cpu_util_cfs(struct rq *rq) { return rq->cfs.avg.util_avg; } + +static inline unsigned long cpu_util_rt(struct rq *rq) +{ + return rq->rt.avg.util_avg; +} + + #endif