Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp1466966imm; Tue, 22 May 2018 04:41:18 -0700 (PDT) X-Google-Smtp-Source: AB8JxZpOjw3yTUJhSKhjnP6i1WUGvDZjn/ya5bOdWyLhHMLVPmEfMuGd9+s2h+0hNwCX6Fy98l5Q X-Received: by 2002:a62:f24a:: with SMTP id y10-v6mr23982675pfl.75.1526989278270; Tue, 22 May 2018 04:41:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526989278; cv=none; d=google.com; s=arc-20160816; b=h/B6cQiaA59BuRrkzY43IVzT4GJZqZyprkJuPjtxTCsOn8Qx4pCK9z0UCM1NxtnhgA 9+z6UhCgiXkxP9nWgy5YSyR9YvUVDGQTAA8BME+9knKmqPJ+FEzGBmDEBhk4VKhB19SE RWPzz2TJc8UMyxNbjMPE4GBXpU2T+LlCNhOYXJ1idDfjy0xFj5dxVQ+1khIDMDJH9KUo ry3+4xber1N/piD6tKXq/aixuWV48C30dTPZDm8ZYckc2xavdO/ErD6xKpv6LYhNTDoR BAR57tliCZPm3AKszTOoKq63O28RbPdV4ow+m6kBkCOe8xilFzk+NihIxDPGj3VsgD3G uBWg== 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:arc-authentication-results; bh=FmqDjurDevsgfLmZFheZJboOpGERPDCyb0MDf294ttg=; b=IJgyRtU7gz8+g63w9jxCCmQ98DpDYTl/UU+h3bTkqlquEE7Xt3/AJhioXGGBa+jppW eL261guPbS1a2WfqEak6niONoALoaZLvlWhdICNL8zJbSFcSA4562k7sBJn70RGF+JLz RSbbgBqNTQOedtj5UfCFBfzgm/HRGT+ZaZMFVcQp6oWWU9uErmBwFh3IDqgAvW8i/E3O YPuyuE2rFSbZoqEhX3Oz2OReYg5tm7t7zU3jjeG1tAdd42aRzqiY09qliTfAInHaDqcb PhObbdcIAq1Z8B3/UsVs6TJqyR3YxWpB5ZTXyFfJR1dJw2mLtrGtnyFCMBr2fZtAem79 rX/g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=P5rCdXEk; 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 t16-v6si16449081pfe.225.2018.05.22.04.41.04; Tue, 22 May 2018 04:41:18 -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=P5rCdXEk; 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 S1752849AbeEVLiz (ORCPT + 99 others); Tue, 22 May 2018 07:38:55 -0400 Received: from mail-pf0-f195.google.com ([209.85.192.195]:33066 "EHLO mail-pf0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752551AbeEVLir (ORCPT ); Tue, 22 May 2018 07:38:47 -0400 Received: by mail-pf0-f195.google.com with SMTP id a20-v6so8649794pfo.0 for ; Tue, 22 May 2018 04:38: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=FmqDjurDevsgfLmZFheZJboOpGERPDCyb0MDf294ttg=; b=P5rCdXEkQVHGM/UmDt3ja6Vc1OLbTQeUTHVeRZfdAzt+OtL9cn2+6qH629SyReYXhL UGPGuo+sfjHPLOo3Zo0psf5Mn7yCLsedwaSnO2q64FA6LdGD0aXrcks6DwIYIsZg7w5B OZrYrxWoAQry+LELSXuwitNDxlG96iHkX18W8= 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=FmqDjurDevsgfLmZFheZJboOpGERPDCyb0MDf294ttg=; b=m/sienkSX4wE32xrXn0rKT9pNCCnZx5ru4s462127rB2MtKjtLEMY15Um33+8g56Q6 G26EI17saan2VIzwXOQboscNrEAoT7Zs+Us6RWU5ycPS9WbSXceJyW5T3pLH1MEDADoR +HYG/US1q3fPJ7kLfX4femPAvJ7I5s1DbOq+/h8R3Xyd+loXqPJh8HnKlYt+cwyx4x6d 73qRGFvMmlyAaodngfGtyMCgUyv5fZ98/YSlYnSvkL/YXVsQxcs5q4PZE+mHbEQC5D7i akGZL6SAATBT86E2s0EkXqBET8NXcicrZnF9FQ0iOIEp1tthLXs6JbG3WUir/SbjLANN TZpg== X-Gm-Message-State: ALKqPwe5lwNst3fZAS1XYT6DaKzvPgG3kpDlEFk0ExRsENciKYR5H2+K U23qOqwSAeahKmqbuk7ua0WKZQ== X-Received: by 2002:a65:64c7:: with SMTP id t7-v6mr19117355pgv.274.1526989127129; Tue, 22 May 2018 04:38:47 -0700 (PDT) Received: from localhost ([122.167.163.112]) by smtp.gmail.com with ESMTPSA id x88-v6sm47039266pfj.126.2018.05.22.04.38.45 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 22 May 2018 04:38:46 -0700 (PDT) Date: Tue, 22 May 2018 17:08:44 +0530 From: Viresh Kumar To: "Rafael J. Wysocki" Cc: "Joel Fernandes (Google.)" , linux-kernel@vger.kernel.org, "Joel Fernandes (Google)" , "Rafael J . Wysocki" , Peter Zijlstra , Ingo Molnar , Patrick Bellasi , Juri Lelli , Luca Abeni , Todd Kjos , claudio@evidence.eu.com, kernel-team@android.com, linux-pm@vger.kernel.org Subject: Re: [PATCH v2] schedutil: Allow cpufreq requests to be made even when kthread kicked Message-ID: <20180522113844.5rz3skjeck57arft@vireshk-i7> References: <20180518185501.173552-1-joel@joelfernandes.org> <4393838.cQWhzXzUcj@aspire.rjw.lan> <20180522105429.yn2omuz63oa2w3ez@vireshk-i7> <6163159.YL3rkaEOau@aspire.rjw.lan> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <6163159.YL3rkaEOau@aspire.rjw.lan> User-Agent: NeoMutt/20180323-120-3dd1ac Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 22-05-18, 13:31, Rafael J. Wysocki wrote: > So below is my (compiled-only) version of the $subject patch, obviously based > on the Joel's work. > > Roughly, what it does is to move the fast_switch_enabled path entirely to > sugov_update_single() and take the spinlock around sugov_update_commit() > in the one-CPU case too. > > --- > kernel/sched/cpufreq_schedutil.c | 57 ++++++++++++++++++++++++++------------- > 1 file changed, 38 insertions(+), 19 deletions(-) > > Index: linux-pm/kernel/sched/cpufreq_schedutil.c > =================================================================== > --- linux-pm.orig/kernel/sched/cpufreq_schedutil.c > +++ linux-pm/kernel/sched/cpufreq_schedutil.c > @@ -92,9 +92,6 @@ static bool sugov_should_update_freq(str > !cpufreq_can_do_remote_dvfs(sg_policy->policy)) > return false; > > - if (sg_policy->work_in_progress) > - return false; > - > if (unlikely(sg_policy->need_freq_update)) > return true; > > @@ -103,25 +100,25 @@ static bool sugov_should_update_freq(str > return delta_ns >= sg_policy->freq_update_delay_ns; > } > > -static void sugov_update_commit(struct sugov_policy *sg_policy, u64 time, > - unsigned int next_freq) > +static bool sugov_update_next_freq(struct sugov_policy *sg_policy, u64 time, > + unsigned int next_freq) > { > - struct cpufreq_policy *policy = sg_policy->policy; > - > if (sg_policy->next_freq == next_freq) > - return; > + return false; > > sg_policy->next_freq = next_freq; > sg_policy->last_freq_update_time = time; > > - if (policy->fast_switch_enabled) { > - next_freq = cpufreq_driver_fast_switch(policy, next_freq); > - if (!next_freq) > - return; > + return true; > +} > > - policy->cur = next_freq; > - trace_cpu_frequency(next_freq, smp_processor_id()); > - } else { > +static void sugov_update_commit(struct sugov_policy *sg_policy, u64 time, > + unsigned int next_freq) > +{ > + if (!sugov_update_next_freq(sg_policy, time, next_freq)) > + return; > + > + if (!sg_policy->work_in_progress) { > sg_policy->work_in_progress = true; > irq_work_queue(&sg_policy->irq_work); > } > @@ -277,6 +274,7 @@ static void sugov_update_single(struct u > { > struct sugov_cpu *sg_cpu = container_of(hook, struct sugov_cpu, update_util); > struct sugov_policy *sg_policy = sg_cpu->sg_policy; > + struct cpufreq_policy *policy = sg_policy->policy; > unsigned long util, max; > unsigned int next_f; > bool busy; > @@ -307,7 +305,23 @@ static void sugov_update_single(struct u > sg_policy->cached_raw_freq = 0; > } > > - sugov_update_commit(sg_policy, time, next_f); > + if (policy->fast_switch_enabled) { Why do you assume that fast switch isn't possible in shared policy cases ? It infact is already enabled for few drivers. -- viresh