Received: by 10.192.165.148 with SMTP id m20csp5291553imm; Wed, 9 May 2018 02:34:25 -0700 (PDT) X-Google-Smtp-Source: AB8JxZpzjI3wAbMAjS/G5r6IUi2ZZRr9F8vimfuDftRLUB9UEa7+tk4k80o6ILhfhmngQY8i9r78 X-Received: by 2002:a63:6584:: with SMTP id z126-v6mr27791060pgb.168.1525858465937; Wed, 09 May 2018 02:34:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525858465; cv=none; d=google.com; s=arc-20160816; b=vZoe9zkx90dlOvlxj0AS7LcqVOq2+ai6CCrBdl5Q27G+ODowBIp1TBmUFDnyI4r4xC D8nv0Rx8PZmHIz4g9h9vSVPKKHDmanUYHAi7CHtEQl3oViYsz82oJxCCVnC+udKAVNj2 lQ14Oww22uC+1mH2KfppjfJw1dMnTXydGD3TXRrhGYitSNB2SrnfTVaMDf0DaqS1rxJf LbXPbq86Aygiu78QhBYei8BgZsvXA1zy7mPBRwZ5wbQxtXHcQiOIReIdzRR/k5gmaVhj AWhz02oZy0sCa44Tb9R93tM3WsVSHV9NyKVrXonuR8AvY9MVsGlQ6UweFMEE3IVw7Y+K I9+g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=BJxL+qF+UIjwzR6gGz4JXBnzyVIPhUDsNJCK7g13ESY=; b=T5IT8Q2x86qFshxEy3b/MBcyXZLNuYwSCVuC9at5YTjgrYsCnGUtWKhJksfne/yDVY aQfLfg4oWDtWO0QWHHHUEXyLmdnafXg3fSoiHYlR8lUBbcrGRyUtqv0wnxaDPAu3W0Y/ zyzmu1X6edqkYfOJuxEr/GRGdNfa6PiQmczGLCdNz2cDLweGh416k5lpj+X3qLU3qbGy sJkl1G+zvYkAHAPtXwp8uh6J9yg99vsCeb5bL5JGXei2MM44Uq9RwJTj3WyTuqCjbpWa 9m+6z0WBg3+8FeCwChNALQ8OI4HEyhBCDy2kjW8NM25HpDppfa8hmgy2V0uYvlS+i2oQ UgDg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=jkD8XBrK; 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=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 3-v6si25614587plm.59.2018.05.09.02.34.11; Wed, 09 May 2018 02:34:25 -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=fail header.i=@gmail.com header.s=20161025 header.b=jkD8XBrK; 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=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934061AbeEIJcY (ORCPT + 99 others); Wed, 9 May 2018 05:32:24 -0400 Received: from mail-ot0-f195.google.com ([74.125.82.195]:41634 "EHLO mail-ot0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933783AbeEIJcV (ORCPT ); Wed, 9 May 2018 05:32:21 -0400 Received: by mail-ot0-f195.google.com with SMTP id t1-v6so39410853oth.8; Wed, 09 May 2018 02:32:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=BJxL+qF+UIjwzR6gGz4JXBnzyVIPhUDsNJCK7g13ESY=; b=jkD8XBrKcZRXNY0UjESOt9bX11ymF2IUEtWVJnvz5TBRr+Afb9VexhiFqQyjvNT7sc a24TRppq2gRhbRBhA3lrlweQevjXxnuj+sANWOuBQlKelGQphfo++kD/LGnlXP/vsjzS /4UHEPupT0FMEBz0+W3ftv5Wg5pIa9B1O6Mz5QzAvjcJ4Qa5nOjB4PvnwQsMVPND7yvg KUUmP4fxlITOzw4UjrY4REBuhH4ZKys123fSRKdv9JyE+RwjkeiPAJTCyWJocix6ufS3 ch1Sxzj/h26OoTM7ZHIoOTU7kcpog7Hcpl1CgHLrJ2o8E9KvBEpRpJTEPfC8Z8tezYew dxyw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=BJxL+qF+UIjwzR6gGz4JXBnzyVIPhUDsNJCK7g13ESY=; b=Ev8anKj0MkAnpuWQZkw8UmmHoWFb47nMjN+JnJg0xgrD0sSffOf3+lgzFbIM/wjgdB 3s52ASnctOEzEc3/N3z7k5qp0dg0WpOTiuyXsUBFfruwdv7So7CMo0hJNFa46qNHpIYT BwV+2tEb/8ms6vI+lG5CwWg+phXt63vGoqIhLfqUKS5i6FX2meVrpHA7cB+6k0IaxxhV 2yq8BJsqPYxj7vjlqL4K9CtN39qp1xKsXERIYSnnK5JP6gHYWYAwwOS8iELzR72l+Btk Ze8oBVBb6L5YT53dO+cDPMA27EC6M+8Nvbih+lz+UAc/PmlsxBIUWgdjfezn7XsV4hgD jB7g== X-Gm-Message-State: ALQs6tAOS8o5XMhzabG/SkvCc6gzDADhgLZo4O7NTQg+RGDz3rRrvNce gP4MKS3Sv0ptq4nfpFcpWx905xABF0uN9BdvBE4= X-Received: by 2002:a9d:5917:: with SMTP id t23-v6mr29830660oth.217.1525858341161; Wed, 09 May 2018 02:32:21 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a9d:1468:0:0:0:0:0 with HTTP; Wed, 9 May 2018 02:32:20 -0700 (PDT) In-Reply-To: <20180509093023.7ex7lglfxo22stgn@vireshk-i7> References: <872c3f8690d9362820639d91a807e535f10a9a36.1525761635.git.viresh.kumar@linaro.org> <20180509084128.s3nu57njyep4tw2w@vireshk-i7> <20180509091519.czq5zu5l7xfhqph4@vireshk-i7> <20180509093023.7ex7lglfxo22stgn@vireshk-i7> From: "Rafael J. Wysocki" Date: Wed, 9 May 2018 11:32:20 +0200 X-Google-Sender-Auth: CpoxTgE03Z_Nf8OPQDWrzYJ3DO4 Message-ID: Subject: Re: [PATCH] sched/schedutil: Don't set next_freq to UINT_MAX To: Viresh Kumar Cc: "Rafael J. Wysocki" , Rafael Wysocki , Ingo Molnar , Peter Zijlstra , Linux PM , Vincent Guittot , Claudio Scordino , Patrick Bellasi , Juri Lelli , Joel Fernandes , "4 . 12+" , Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, May 9, 2018 at 11:30 AM, Viresh Kumar wrote: > On 09-05-18, 11:23, Rafael J. Wysocki wrote: >> On Wed, May 9, 2018 at 11:15 AM, Viresh Kumar wrote: >> > On 09-05-18, 10:56, Rafael J. Wysocki wrote: >> >> I'm kind of concerned about updating the limits via sysfs in which >> >> case the cached next frequency may be out of range, so it's better to >> >> invalidate it right away then. >> > >> > That should not be a problem as __cpufreq_driver_target() will anyway >> > clamp the target frequency to be within limits, whatever the cached >> > value of next_freq is. >> >> The fast switch case doesn't use it, though. > > cpufreq_driver_fast_switch() does the same clamping :) > >> > And we aren't invalidating the cached next freq immediately currently >> > as well, as we are waiting until the next time the util update handler >> > is called to set sg_policy->next_freq to UINT_MAX. >> > >> >> > What else do you have in mind to solve this problem ? >> >> >> >> Something like the below? >> >> >> >> --- >> >> kernel/sched/cpufreq_schedutil.c | 3 ++- >> >> 1 file changed, 2 insertions(+), 1 deletion(-) >> >> >> >> Index: linux-pm/kernel/sched/cpufreq_schedutil.c >> >> =================================================================== >> >> --- linux-pm.orig/kernel/sched/cpufreq_schedutil.c >> >> +++ linux-pm/kernel/sched/cpufreq_schedutil.c >> >> @@ -305,7 +305,8 @@ static void sugov_update_single(struct u >> >> * Do not reduce the frequency if the CPU has not been idle >> >> * recently, as the reduction is likely to be premature then. >> >> */ >> >> - if (busy && next_f < sg_policy->next_freq) { >> >> + if (busy && next_f < sg_policy->next_freq && >> >> + sg_policy->next_freq != UINT_MAX) { >> >> next_f = sg_policy->next_freq; >> >> >> >> /* Reset cached freq as next_freq has changed */ >> > >> > This will fix the problem we have identified currently, but adding a >> > special meaning to next_freq == UINT_MAX invites more hidden corner >> > cases like the one we just found. IMHO, using next_freq only for the >> > *real* frequency values makes its usage more transparent and readable. >> > And we already have the need_freq_update flag which we can use for >> > this special purpose, as is done in my patch. >> >> So I prefer to do the above as a -stable fix and make the UNIT_MAX >> change on top of that. > > Okay, that's fine with me. Will send the next version now :) > > Just to make sure, you are fine with the "Fixes" tag now (since you > objected to that earlier) ? OK, so to be clear, I'm going to queue up the simple patch I posted with a FIxes: tag. I'll resend it with a changelog shortly. Then please send a UINT_MAX change on top of that and it won't be an urgent fix any more.