From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1760469AbbKTPTx (ORCPT ); Fri, 20 Nov 2015 10:19:53 -0500 Received: from mail-pa0-f52.google.com ([209.85.220.52]:36116 "EHLO mail-pa0-f52.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1759787AbbKTPTu (ORCPT ); Fri, 20 Nov 2015 10:19:50 -0500 Date: Fri, 20 Nov 2015 20:49:44 +0530 From: Viresh Kumar To: Prarit Bhargava Cc: linux-kernel@vger.kernel.org, Srinivas Pandruvada , Len Brown , Alexandra Yates , Kristen Carlson Accardi , "Rafael J. Wysocki" , linux-pm@vger.kernel.org Subject: Re: [PATCH 1/2] cpufreq, intel_pstate, Fix limits->max_policy_pct rounding error Message-ID: <20151120151944.GE3957@ubuntu> References: <1448022757-7856-1-git-send-email-prarit@redhat.com> <1448022757-7856-2-git-send-email-prarit@redhat.com> <20151120131833.GD3957@ubuntu> <564F37C8.60307@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <564F37C8.60307@redhat.com> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 20-11-15, 10:10, Prarit Bhargava wrote: > >> limits->max_policy_pct = clamp_t(int, limits->max_policy_pct, 0 , 100); > > > > And put this after the later one ? > > > >> + limits->max_policy_pct = DIV_ROUND_UP(policy->max * 100, > >> + policy->cpuinfo.max_freq); > >> > >> /* Normalize user input to [min_policy_pct, max_policy_pct] */ > >> limits->min_perf_pct = max(limits->min_policy_pct, > > > > Sure you tested it ? :) > > Oops -- and yeah, tested. It works because I rewrite the value of > max_policy_pct :). I'll repost shortly. But we aren't doing below anymore, doesn't this change the calculations at all? limits->max_policy_pct = clamp_t(int, limits->max_policy_pct, 0 , 100); -- viresh