From patchwork Tue Jul 4 17:34:06 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrick Bellasi X-Patchwork-Id: 107004 Delivered-To: patch@linaro.org Received: by 10.140.101.44 with SMTP id t41csp1251003qge; Tue, 4 Jul 2017 10:34:41 -0700 (PDT) X-Received: by 10.98.21.9 with SMTP id 9mr16285156pfv.234.1499189681225; Tue, 04 Jul 2017 10:34:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1499189681; cv=none; d=google.com; s=arc-20160816; b=uxERStpVWpwPFyEbFLdm2QUmFRn5uctUAImb2XUVDq5fqDrhzTUGn975V3hYdn3ZvD cEsP6amQe5F2CDcV0idJX6zWeAA7T0+3SV84ouPXtetDFok72QY6In85gb2Gru9cZ/ar vyUm5Zbvo12JT7FhxVIxTceN3s4EjcQsWJEwc5qAjjjbbRwb4NUKUZnD3e7wYY93jDfw a9286r3GQMrSVo2GaqAuJ1kQVQ0wJnwIcG7XzYrdM/ufOYjBUCb6VNFr6cP+QaJmh5jm wE+tdjHjNU2IPYqHu7cuLQPhN1EZJQx06qwpGuvli3Id1YDPn/qEyvbHz0llUF6pnEAW NS9Q== 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:arc-authentication-results; bh=ghGBEy5shP1bOgvtQRBTwgTUZlZTbkHOPjkcKVBEJYU=; b=ShH6qDp7o53bqNhS+GvpSmayyJ66H9YMibPmvYlj7NpvxWHnpni77KvamLuypYXTQW jAD7Woj2QQyhbZP7MCvj7LCwQ1ZN+T/J9KzXfNBZ3adQg+6vO8CKIEy1xT6VaN+gz7xd pgYE/T1WD04fCQltvUwzkb7TN+AFD6t0YXn/Zfi4QdxwvQi0of/Bpwd2pjUiMZG6oCDU RmnehFqe4ufzGEvsPdD4JiiVQ6imbm+Rpn8ESQJuM+x00ftyFNmKpljgzYJhKu0jI7uo eWTfKKHIN9lIBawF/k25Jzu/mQLibzsuuaJq7fphNc+/h0+fLNf9pPHePv+1EfraxKRm Q4jA== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k62si15022999pgk.580.2017.07.04.10.34.40; Tue, 04 Jul 2017 10:34:41 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752224AbdGDRe2 (ORCPT + 25 others); Tue, 4 Jul 2017 13:34:28 -0400 Received: from foss.arm.com ([217.140.101.70]:48100 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751982AbdGDReZ (ORCPT ); Tue, 4 Jul 2017 13:34:25 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 362C915A2; Tue, 4 Jul 2017 10:34:25 -0700 (PDT) Received: from e110439-lin.cambridge.arm.com (e110439-lin.cambridge.arm.com [10.1.210.68]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 130FF3F41F; Tue, 4 Jul 2017 10:34:22 -0700 (PDT) From: Patrick Bellasi To: linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org Cc: Ingo Molnar , Peter Zijlstra , "Rafael J . Wysocki" , Viresh Kumar , Vincent Guittot , Juri Lelli , Joel Fernandes , Andres Oportus , Todd Kjos , Morten Rasmussen , Dietmar Eggemann Subject: [PATCH v2 1/6] cpufreq: schedutil: ignore sugov kthreads Date: Tue, 4 Jul 2017 18:34:06 +0100 Message-Id: <1499189651-18797-2-git-send-email-patrick.bellasi@arm.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1499189651-18797-1-git-send-email-patrick.bellasi@arm.com> References: <1499189651-18797-1-git-send-email-patrick.bellasi@arm.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org In system where multiple CPUs shares the same frequency domain a small workload on a CPU can still be subject to frequency spikes, generated by the activation of the sugov's kthread. Since the sugov kthread is a special RT task, which goal is just that to activate a frequency transition, it does not make sense for it to bias the schedutil's frequency selection policy. This patch exploits the information related to the current task to silently ignore cpufreq_update_this_cpu() calls, coming from the RT scheduler, while the sugov kthread is running. Signed-off-by: Patrick Bellasi Cc: Ingo Molnar Cc: Peter Zijlstra Cc: Rafael J. Wysocki Cc: Viresh Kumar Cc: linux-kernel@vger.kernel.org Cc: linux-pm@vger.kernel.org --- Changes from v1: - move check before policy spinlock (JuriL) --- kernel/sched/cpufreq_schedutil.c | 8 ++++++++ 1 file changed, 8 insertions(+) -- 2.7.4 diff --git a/kernel/sched/cpufreq_schedutil.c b/kernel/sched/cpufreq_schedutil.c index c982dd0..eaba6d6 100644 --- a/kernel/sched/cpufreq_schedutil.c +++ b/kernel/sched/cpufreq_schedutil.c @@ -218,6 +218,10 @@ static void sugov_update_single(struct update_util_data *hook, u64 time, unsigned int next_f; bool busy; + /* Skip updates generated by sugov kthreads */ + if (unlikely(current == sg_policy->thread)) + return; + sugov_set_iowait_boost(sg_cpu, time, flags); sg_cpu->last_update = time; @@ -290,6 +294,10 @@ static void sugov_update_shared(struct update_util_data *hook, u64 time, unsigned long util, max; unsigned int next_f; + /* Skip updates generated by sugov kthreads */ + if (unlikely(current == sg_policy->thread)) + return; + sugov_get_util(&util, &max); raw_spin_lock(&sg_policy->update_lock);