Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp3464094imm; Fri, 25 May 2018 06:14:34 -0700 (PDT) X-Google-Smtp-Source: AB8JxZpQrS+q7P5+xcTb4LhiaFRCRbqs+TntTyZznDalQHm/0w9hk73gZIkNluMkyCH9FXE0c3gW X-Received: by 2002:a62:ea1a:: with SMTP id t26-v6mr2550527pfh.117.1527254074820; Fri, 25 May 2018 06:14:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527254074; cv=none; d=google.com; s=arc-20160816; b=D/k551yOCkBfHEQsnqXESArSFm+ftgA577UWyPNA081NCCCvHpkB7WGJ/4Gtg/0bQ6 CQIPfCVfcsGw6OXzLoLcsg7SZKEEwi6aW6u9AtQa6T7BfED1akv1aIo/EanNnMaGPB59 0hska8+JH49zBosDnP/LC7dUs4GBxY+GG7C8FwoEsR5Ic2Zbm26uCKBCvBLdlxg/lpj/ 5vukbDVmK//fSG5q4jRTjJQ1AFCfLTVtU2ewlGXsU0d81Slzce1ZyYxno7MRtFsi0tbK vF9VlX5ZfkN6YP9PSOqJek7V5SsmzCMwFtQmAmeVG6SPmCGxN615EXEtd4jNxx24JEsM t3GA== 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=ckwiXhqSqL/YEUNswdXJMutapFI7vaVSbxoivzluzcc=; b=tJo+e3+QDo4vHxsea+nEAZs6Counn2XV+b7b4rzHA/mC5jzK4eCG1I+cKcwYYtxrRJ uBVH8128uF+hmBAXC8nNs2lh5CqYLoxlE/sjoVvuvEXOur3IzbYhv6joDABTTtK16WES 5ZTkaBHkadx0Lduz5MC2zYh7yd6usvJ2aIGmwo7abp7mYK6HakrXxnZwU0yYehGj4qsq pEmssYNx5OpJ/q/W2dvI/ZJ4/fNEnholCdxirHFJGiBAGfjXYvfpB2yttgTF3THtMtyh DDiiYf7cU7D+Tq7oWrGMAYucU/IEnNI98OxH9ZSUjPxZ603gjQXU1oyEdrByb8cRjyRA +XiQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=egaIChKA; 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 t9-v6si24371668pfk.228.2018.05.25.06.14.19; Fri, 25 May 2018 06:14:34 -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=egaIChKA; 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 S936124AbeEYNNm (ORCPT + 99 others); Fri, 25 May 2018 09:13:42 -0400 Received: from mail-wm0-f67.google.com ([74.125.82.67]:52388 "EHLO mail-wm0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S935724AbeEYNMt (ORCPT ); Fri, 25 May 2018 09:12:49 -0400 Received: by mail-wm0-f67.google.com with SMTP id 18-v6so8722041wml.2 for ; Fri, 25 May 2018 06:12:48 -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=ckwiXhqSqL/YEUNswdXJMutapFI7vaVSbxoivzluzcc=; b=egaIChKAzQujU2x9a33Nzc8IEPOnS4NiWi82p4xZiHi+i44CZrLajoyv0Dy7p+U0Pv O+JLuviVI76XpmtbQUpz8v9Vd3EokBE3SO3HEJR1xqv7LBmv7p+2B4asvgMVRykjVX4P yL3+ara2H8us+6o4VQenahEhtiWfODJxPLruo= 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=ckwiXhqSqL/YEUNswdXJMutapFI7vaVSbxoivzluzcc=; b=izmzKUA/vTOQZXo9cyLd7E5Ah2B6iRgQ3pLRqvtMLG9LDg2NO2IZCBkS6f4Al4A9Cz C8hgQbQL1bM8U4xx9JBYCk17NOSSUxVimWDk8xyGUASdu/UxnnBmwEx/lzYsjDDVsorm jQPoa+oe2uJTI4ATT1fSaKsYQTqYPbl4V+YqQkXsCfB72Hp7oeKv6RF6uHdEMJQHihen As/aRwkwc3ILdLH2wvTUYBAz7cRXiS6CnlqgKSm8wJy0eESgAWCJaIGSgMsPDiPEmgA2 gn8+pgrOrMaKGukRSuTB9JOH616BvV5GWsFCRXBOom8VJkvKiJEhFfc5zBx0HaTpBTa6 85LA== X-Gm-Message-State: ALKqPwdIcnvOhLMx4YTn9WrOdGc2UQkV65EwoxQP7pr691+pqCQ0UYnG Ias4oI+6WxNgCCGZh9qFlcX7MMAxYHY= X-Received: by 2002:a1c:2350:: with SMTP id j77-v6mr1610292wmj.108.1527253968092; Fri, 25 May 2018 06:12:48 -0700 (PDT) Received: from localhost.localdomain ([2a01:e0a:f:6020:a860:64b4:335b:c763]) by smtp.gmail.com with ESMTPSA id 4-v6sm9690948wmg.8.2018.05.25.06.12.47 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 25 May 2018 06:12:47 -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, quentin.perret@arm.com, Vincent Guittot Subject: [PATCH v5 08/10] cpufreq/schedutil: take into account interrupt Date: Fri, 25 May 2018 15:12:29 +0200 Message-Id: <1527253951-22709-9-git-send-email-vincent.guittot@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1527253951-22709-1-git-send-email-vincent.guittot@linaro.org> References: <1527253951-22709-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 The time spent under interrupt can be significant but it is not reflected in the utilization of CPU when deciding to choose an OPP. Now that we have access to this metric, schedutil can take it into account when selecting the OPP for a CPU. The CPU utilization is : irq util_avg + (1 - irq util_avg / max capacity ) * /Sum rq util_avg A test with iperf on hikey (octo arm64) gives: iperf -c server_address -r -t 5 w/o patch w/ patch Tx 276 Mbits/sec 304 Mbits/sec +10% Rx 299 Mbits/sec 328 Mbits/sec +09% 8 iterations stdev is lower than 1% Only WFI idle state is enable (shallowest diel state) Signed-off-by: Vincent Guittot --- kernel/sched/cpufreq_schedutil.c | 10 ++++++++++ kernel/sched/sched.h | 5 +++++ 2 files changed, 15 insertions(+) diff --git a/kernel/sched/cpufreq_schedutil.c b/kernel/sched/cpufreq_schedutil.c index a84b5a5..06f2080 100644 --- a/kernel/sched/cpufreq_schedutil.c +++ b/kernel/sched/cpufreq_schedutil.c @@ -57,6 +57,7 @@ struct sugov_cpu { unsigned long util_cfs; unsigned long util_dl; unsigned long util_rt; + unsigned long util_irq; unsigned long max; /* The field below is for single-CPU policies only: */ @@ -180,6 +181,7 @@ static void sugov_get_util(struct sugov_cpu *sg_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); + sg_cpu->util_irq = cpu_util_irq(rq); } static unsigned long sugov_aggregate_util(struct sugov_cpu *sg_cpu) @@ -190,9 +192,17 @@ static unsigned long sugov_aggregate_util(struct sugov_cpu *sg_cpu) if (rq->rt.rt_nr_running) { util = sg_cpu->max; } else { + /* Sum rq utilization*/ util = sg_cpu->util_dl; util += sg_cpu->util_cfs; util += sg_cpu->util_rt; + + /* Weight rq's utilization to the normal context */ + util *= (sg_cpu->max - sg_cpu->util_irq); + util /= sg_cpu->max; + + /* Add interrupt utilization */ + util += sg_cpu->util_irq; } /* diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h index f7e8d5b..718c55d 100644 --- a/kernel/sched/sched.h +++ b/kernel/sched/sched.h @@ -2218,4 +2218,9 @@ static inline unsigned long cpu_util_rt(struct rq *rq) { return rq->avg_rt.util_avg; } + +static inline unsigned long cpu_util_irq(struct rq *rq) +{ + return rq->avg_irq.util_avg; +} #endif -- 2.7.4