From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1760451AbcBYLC3 (ORCPT ); Thu, 25 Feb 2016 06:02:29 -0500 Received: from v094114.home.net.pl ([79.96.170.134]:59831 "HELO v094114.home.net.pl" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S1760225AbcBYLC1 (ORCPT ); Thu, 25 Feb 2016 06:02:27 -0500 From: "Rafael J. Wysocki" To: Steve Muckle Cc: Peter Zijlstra , Ingo Molnar , "Rafael J. Wysocki" , linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, Vincent Guittot , Morten Rasmussen , Dietmar Eggemann , Juri Lelli , Patrick Bellasi , Michael Turquette , Ricky Liang , Juri Lelli Subject: Re: [RFCv7 PATCH 03/10] sched: scheduler-driven cpu frequency selection Date: Thu, 25 Feb 2016 12:04 +0100 Message-ID: <6080807.PFHSVxFDKN@vostro.rjw.lan> User-Agent: KMail/4.11.5 (Linux/4.5.0-rc1+; KDE/4.11.5; x86_64; ; ) In-Reply-To: <8427745.Y8N2bqC3SO@vostro.rjw.lan> References: <1456190570-4475-1-git-send-email-smuckle@linaro.org> <1456190570-4475-4-git-send-email-smuckle@linaro.org> <8427745.Y8N2bqC3SO@vostro.rjw.lan> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="utf-8" Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thursday, February 25, 2016 04:55:57 AM Rafael J. Wysocki wrote: > Hi, > [cut] > > + while (true) { > > + set_current_state(TASK_INTERRUPTIBLE); > > + if (kthread_should_stop()) { > > + set_current_state(TASK_RUNNING); > > + break; > > + } > > + new_request = gd->requested_freq; > > + if (!gd->enabled || new_request == last_request) { > > This generally is a mistake. > > You can't assume that if you had requested a CPU to enter a specific P-state, > that state was actually entered. In the platform-coordinated case the hardware > (or firmware) may choose to ignore your request and you won't be told about > that. > > For this reason, you generally need to make the request every time even if it > is identical to the previous one. Even in the one-CPU-per-policy case there > may be HW coordination you don't know about. Please scratch this bit, actually (and analogous comments below). It is reasonable to expect that the platform will remember your last request, so you don't have to repeat it. Which means that I can optimize the schedutil thing somewhat. :-) Thanks, Rafael