Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3315003imu; Fri, 18 Jan 2019 08:18:53 -0800 (PST) X-Google-Smtp-Source: ALg8bN4myCqgkQN0WO3aXT2aGMRzLJt4KBE2Dm4MY0tsC+wnch6c/ArgPEPA+hmsfFSxd9B5mihF X-Received: by 2002:a62:7086:: with SMTP id l128mr19893428pfc.68.1547828333859; Fri, 18 Jan 2019 08:18:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547828333; cv=none; d=google.com; s=arc-20160816; b=nIUusu0EagVAVawe38O9auzLX/C43pDS/YAL1SW7pWRH2MEpUqj6AZaLcDojpQPVbK zSy63bvsobRW1GGkUtU21SSjLLNrNmkukmh9qOGMFxjEYT6LOoeNuKQI/Br61LdX7b9T FWOlcWg91xgf8eKCTGutj5iGekvLb/A2oG8YX3VleLu2y3vLFYH9vnOW0djK1d/IP2co I8sVMY9lUo6njqARAFBD3mD1/vzrSezzyzILAIe2XzZJLT1Kttz/UGi/12mcThKeUEBU XlokRlKR/59/lxJ4/c0oRSBhiarZ57sIQcLaDkG+AUVZ0u7z1lraq8x3EfSd2pg9AouY brUg== 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; bh=8J0KEgksINfaZwZNgj6ZCNAGBR3wkWZqqcLlb6hhP/E=; b=g/T271qUsI4rSTPUFJ8+xCp61vlwaGL6XD9AilGEDp6Bs3+SzGJz4QRo8p6VtaZP3t bRhDeiMrIl2n7etQWwdM6XVpw0jN2WUENej36uQPnHE8L5F0eBle3iWasHAoI6GdUmVl 3zOybzndBPSaY8O1pfYkNSW5r+mZ5QX73ptZDeWwZIbxGkLVbuTGcWpzBSgClpH0MSMP Ex49wqbrSyp5AmDux1YaW+70rIgeylwefjeZtvYJTi7KEEqV7mInQPnRsg+FVpvAUw+I CfM/L31HuGpn8YSHToOERdvhm+k9JxEZqX33+znlPhC4VRpEhm4lWwaYMcQin0I/y5LN ae9A== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=merlin.20170209 header.b=vPUmQTyo; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i6si4974064plt.290.2019.01.18.08.18.34; Fri, 18 Jan 2019 08:18:53 -0800 (PST) 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=@infradead.org header.s=merlin.20170209 header.b=vPUmQTyo; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728203AbfARQQ0 (ORCPT + 99 others); Fri, 18 Jan 2019 11:16:26 -0500 Received: from merlin.infradead.org ([205.233.59.134]:33800 "EHLO merlin.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727241AbfARQQ0 (ORCPT ); Fri, 18 Jan 2019 11:16:26 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=8J0KEgksINfaZwZNgj6ZCNAGBR3wkWZqqcLlb6hhP/E=; b=vPUmQTyoS8r9xPbjTsgvLC4f5 6PyhG9WFkJZllxljlHBMpQVpKMBa7fI3wOgzujeTEyn9GRbIy/qlq3slvLrGyueoaFriIG07f7OmR CU9aLkCqZ9VzchYmENm68HI67jhGzjWrSkNAwqCnR4iKwNFJtZ3hrbQsQf9Ltj1ZpHpyoNSbjXnES CldzsuMFhs08RUb3mR6WPONlrF/bS1PNltQ/QcpMMovfHDBBWktEtt7xsCMZuNaRmhbzxzanpf0qP sHtO4XKN7y5U+2tnKvengidENL9TULbN61kTLMSyryvr6LjEutvXbfSZG0buBYYr+vUtrYV7HBn/k p3llGvTRg==; Received: from [89.200.44.227] (helo=worktop.programming.kicks-ass.net) by merlin.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1gkWob-00046w-VG; Fri, 18 Jan 2019 16:16:18 +0000 Received: by worktop.programming.kicks-ass.net (Postfix, from userid 1000) id 4454B9818FF; Fri, 18 Jan 2019 17:16:16 +0100 (CET) Date: Fri, 18 Jan 2019 17:16:16 +0100 From: Peter Zijlstra To: Chunyan Zhang Cc: Ingo Molnar , Vincent Wang , Quentin Perret , linux-kernel@vger.kernel.org, Chunyan Zhang Subject: Re: [PATCH V2] sched/cpufreq: calculate util / cap in advance in map_util_freq() Message-ID: <20190118161616.GH14054@worktop.programming.kicks-ass.net> References: <1547089325-15691-1-git-send-email-chunyan.zhang@unisoc.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1547089325-15691-1-git-send-email-chunyan.zhang@unisoc.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jan 10, 2019 at 11:02:05AM +0800, Chunyan Zhang wrote: > From: Vincent Wang > > When a task that is in_iowait state is enqueued, cpufreq_update_util() > will be invoked with SCHED_CPUFREQ_IOWAIT flag. In this case,the value > of util and cap, which are parameters used in map_util_freq(), will be > cpu frequency, instead of cpu util and capactiy. > > For some 32bit architectures, the size of unsigned long is 32. When > calculating freq, there may be an overflow error in this expression: Would it not be much better to fix that one case instead of adding extra instructions for everyone all the time?