Received: by 10.192.165.148 with SMTP id m20csp5291168imm; Wed, 9 May 2018 02:33:58 -0700 (PDT) X-Google-Smtp-Source: AB8JxZonk8ZMd1j5Rf1VcCYCgXyOq3vCv0zwTwvZmjzigMbIxiKz6bDq8oYpiwi1lKhPFLKf0nSS X-Received: by 2002:a65:498e:: with SMTP id r14-v6mr34455101pgs.78.1525858438614; Wed, 09 May 2018 02:33:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525858438; cv=none; d=google.com; s=arc-20160816; b=aXANF9LnUIoCyOu3DDHLDxCWJRBCczaSiNVPuQTz5OYO9RmYH9HVPIMvs6FlQqbGTQ P/UTqFiGQYRSRhxEEPhhYhg+lpF3b9Y9kIosrFjSKABhMPDULlpxBQOG/n/8JJlmEdXd F+t1JziGeTw2mzxtNKUvB9SRTHS6fgZGJTkal4mrpMpVWEmcdQ2m4RV+kGH8ixsEO+Ws K5RLMtwETVlC3IQPJLtGtwzBeEf+aXsbe5dYod0BCDQu5n2pIJdoDu2gjkQXI6l03jTr csjVEZBKL8F5YpqvirLw0/u0jWrRUOEYLUMnUHJpJO82pT8e+Bf/Nf5fjXjm7LTx60xG HXgQ== 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=r6NPjlfjByQTGygodhHAdTqqstUzLCZs/WVrYpwNf7o=; b=F0IGBEpT8Luut2ypvxcH1K26iX0mSaabOMOk9lKEDow/9xaNXUlEgWarRD/HKTtK5C GrWnk2ltuA39t+thF8wolsffAqXVIHVKomJsbq1rHYzZkmgezNBiED+ky43EVHNiHtPd cgyrLxwjZ77h7I2Y7f2410BkC34QEbhaWiPE+l6+sP0vGB9UpCZ+FRdr+8zjyUTZHHw6 tZSsvLj9OOIEQAEimhzdLo2WXKXRSTUa6WCoXn0ZI4utrI8lPJwO0RYjNKfTbbYHCHAP SCcd1yKYwo/vpwlUrV+lAmYb56A+ipPoYYNV6A9y4H7SA1oWiZRVhViPby6+3+5lKgG+ ON6w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=kEzdNrUT; 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 m1-v6si25108574plt.276.2018.05.09.02.33.44; Wed, 09 May 2018 02:33:58 -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=kEzdNrUT; 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 S933810AbeEIJa3 (ORCPT + 99 others); Wed, 9 May 2018 05:30:29 -0400 Received: from mail-pl0-f66.google.com ([209.85.160.66]:42235 "EHLO mail-pl0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753339AbeEIJa0 (ORCPT ); Wed, 9 May 2018 05:30:26 -0400 Received: by mail-pl0-f66.google.com with SMTP id u6-v6so3950822pls.9 for ; Wed, 09 May 2018 02:30:26 -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=r6NPjlfjByQTGygodhHAdTqqstUzLCZs/WVrYpwNf7o=; b=kEzdNrUT+WkzdeGHUnQuXo6BSyp+dy5xkTGxpzKiLBDfN3cuNU48ZuY3I+gZvwQ/Af SRvz98y97pGDTmmR6YZo9rCjQ+t4uSG94c5IBJszQejVnbJMgy6XCqqrDfnAck4s0ynX YRYeDQkGHkDePPWSve1mc6hHCu5l2/jt7yqwY= 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=r6NPjlfjByQTGygodhHAdTqqstUzLCZs/WVrYpwNf7o=; b=lrEeO3ZBHnbe9TORbQ8QHXMgiZ+exh79cr0CKSi9PhKsiWPZF3sUeqWF42t72yCEk5 SP6SK+SaGk7Smq5JQql+jlV2n7dakkbTKicE2aIHKeHLaRekSiTUbXFl2ZyiEcYzB6Bd YliBSsZV6wfRFNV5U+OcZWI3WlmtPMCR/WO93YOUMluy0qfCQsrmVn1t07LzFcnMWVZV zlnfHMqI8+PeUpuRyVwh6EqFTLKP06eVUFIouILbYgaa9KdI5rX96+wujw1lTrrjaoua N1f2gcUFenZ8iWhsOzjFx6L8D7XPQthpHCu9T6UplCjXIaP4jYPvK8RoaE/Ymw78c/IM 3rDw== X-Gm-Message-State: ALQs6tCcn4cSHlL1UiD1wlcepGqwW/wkVZQfRFIuUBm8Jv6dkf4YLxRd 3S83jAF+IzRpRyVMovraKdZANg== X-Received: by 2002:a17:902:70c4:: with SMTP id l4-v6mr42348817plt.174.1525858226074; Wed, 09 May 2018 02:30:26 -0700 (PDT) Received: from localhost ([122.167.163.112]) by smtp.gmail.com with ESMTPSA id o123-v6sm42367865pga.76.2018.05.09.02.30.25 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 09 May 2018 02:30:25 -0700 (PDT) Date: Wed, 9 May 2018 15:00:23 +0530 From: Viresh Kumar To: "Rafael J. Wysocki" Cc: Rafael Wysocki , Ingo Molnar , Peter Zijlstra , Linux PM , Vincent Guittot , Claudio Scordino , Patrick Bellasi , Juri Lelli , Joel Fernandes , "4 . 12+" , Linux Kernel Mailing List Subject: Re: [PATCH] sched/schedutil: Don't set next_freq to UINT_MAX Message-ID: <20180509093023.7ex7lglfxo22stgn@vireshk-i7> References: <872c3f8690d9362820639d91a807e535f10a9a36.1525761635.git.viresh.kumar@linaro.org> <20180509084128.s3nu57njyep4tw2w@vireshk-i7> <20180509091519.czq5zu5l7xfhqph4@vireshk-i7> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: 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 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) ? -- viresh