Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp339294pxu; Thu, 3 Dec 2020 01:19:53 -0800 (PST) X-Google-Smtp-Source: ABdhPJwr6oT3PndAj0GUn72Ch9UEDG5svMMqGMqsgFmw/M0c3e8vriSPj0mTJHLRR419LgfXzAji X-Received: by 2002:a50:e042:: with SMTP id g2mr1932022edl.292.1606987193335; Thu, 03 Dec 2020 01:19:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606987193; cv=none; d=google.com; s=arc-20160816; b=okyOsuIES0F+jd2SDIJA03jQn8/ElgxQDiT+HaUD5KP6OZ0VX8j9LU0w2JXofvx97a mEhcscUE3y5qLYU4FLYYdBjcYUtI7ZVViDYYj4X6PGROPv3c4E9arsNR7Wsx02f9cDLK 8bdkcw6KMY0kgNgjIvdvmwvrLySnj6n1WiH9cXtk2D3j/n87SJYZ2LqtwXdt3jWMZenZ tvX4S6cP0tTwjjdKf1/Uaf6OkltT98N+t3SP9zDlgX9KIYVGcJ712YClkf01l1G00gUU opV7akggI5emg3bKPk+A1lIxcXYRZvabKF4vB/5oHHR1f7iJPm23/MlrTBOObGKMBLax ZFDQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:robot-unsubscribe :robot-id:message-id:mime-version:references:in-reply-to:cc:subject :to:reply-to:sender:from:dkim-signature:dkim-signature:date; bh=VIkKosaBcX+Ew9O7TRSvoATVKwe3UK0Q+EST2eiBX3M=; b=fjK1bkREjAcPwG9E5gH2bd6jW8FnglWwaPxr3XUF5OwY+SKpv+GY7vRa0Slsmf/lYS vtLh051LiYLjDct05Xgnruhw2VyRUopMEwNH6IRc+aBvFrk0Apb3NWA49j3e4dja5+o6 PE2dofRrfnqr2nPoSY9ELObakodsraWDfCVMPrY3RR4fW4pDRrbsdDzK8qTY+cxMUAah 32qKeHRZU2iBWIorapYpiJHlAKD5VGBXVPH7hVNfsYidDbfSBkosHHgThcUMTCJWQYt4 0sW0x18/DfLcEOv8n/9L5e2psa8jB7R4HxBS0ocXNc3VP5WCE4Q3Jrcmh0llk8nrVBvQ 0jWA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=InWutED0; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=PdtnRIrC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id s13si752777ejv.28.2020.12.03.01.19.30; Thu, 03 Dec 2020 01:19:53 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=InWutED0; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=PdtnRIrC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388599AbgLCJPL (ORCPT + 99 others); Thu, 3 Dec 2020 04:15:11 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47280 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728764AbgLCJOC (ORCPT ); Thu, 3 Dec 2020 04:14:02 -0500 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9B3C8C061A4E; Thu, 3 Dec 2020 01:13:22 -0800 (PST) Date: Thu, 03 Dec 2020 09:13:20 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1606986801; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=VIkKosaBcX+Ew9O7TRSvoATVKwe3UK0Q+EST2eiBX3M=; b=InWutED0oVr6hdMklslXLHrI2lwXpvqJ2gcMSSP2a9T6IZyY+mNR7VFKOHaMwBePemEZCa RXVZxinOHJ+hkIVExp802jsUAkrci2z4ywpHsiIIxo+WavyBt/tLuPZaqwA5j86++wults zkcVaBqiG+R2yoDRzRaylHsnBX9aOK/8UChwDaTEWro5EdF46DW7PRHT6fB56VLnOWAym6 hOjNuoBMuPpsrSJJVXbqIKBADrUVPpl2y4FU97WX7tj+US9QGbm0y+xgO2mQ1oHIBaSOr1 34ZwvufJxTGpio54tPSvPA1kA+mswYjtRlFNOPGQfytlmDpBg5IT01eEGuv4QA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1606986801; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=VIkKosaBcX+Ew9O7TRSvoATVKwe3UK0Q+EST2eiBX3M=; b=PdtnRIrCeNr0L7M1hh3TMvtcDC4xwJ5gwA/oZE+y+CRveABXMz7jhiiZy8bUqYdMDGBmJc pCqqaKqxbObSwuDQ== From: "tip-bot2 for Giovanni Gherdovich" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: sched/core] x86, sched: Use midpoint of max_boost and max_P for frequency invariance on AMD EPYC Cc: "Peter Zijlstra (Intel)" , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20201112182614.10700-3-ggherdovich@suse.cz> References: <20201112182614.10700-3-ggherdovich@suse.cz> MIME-Version: 1.0 Message-ID: <160698680062.3364.2318205075982527285.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The following commit has been merged into the sched/core branch of tip: Commit-ID: 46609527577d1def0af29ca5b56cffeeea771ada Gitweb: https://git.kernel.org/tip/46609527577d1def0af29ca5b56cffeeea771ada Author: Giovanni Gherdovich AuthorDate: Thu, 12 Nov 2020 19:26:13 +01:00 Committer: Peter Zijlstra CommitterDate: Thu, 03 Dec 2020 10:00:35 +01:00 x86, sched: Use midpoint of max_boost and max_P for frequency invariance on AMD EPYC Frequency invariant accounting calculations need the ratio freq_curr/freq_max, but freq_max is unknown as it depends on dynamic power allocation between cores: AMD EPYC CPUs implement "Core Performance Boost". Three candidates are considered to estimate this value: - maximum non-boost frequency - maximum boost frequency - the mid point between the above two Experimental data on an AMD EPYC Zen2 machine slightly favors the third option, which is applied with this patch. The analysis uses the ondemand cpufreq governor as baseline, and compares it with schedutil in a number of configurations. Using the freq_max value described above offers a moderate advantage in performance and efficiency: sugov-max (freq_max=max_boost) performs the worst on tbench: less throughput and reduced efficiency than the other invariant-schedutil options (see "Data Overview" below). Consider that tbench is generally a problematic case as no schedutil version currently is better than ondemand. sugov-P0 (freq_max=max_P) is the worst on dbench, while the other sugov's can surpass ondemand with less filesystem latency and slightly increased efficiency. 1. DATA OVERVIEW 2. DETAILED PERFORMANCE TABLES 3. POWER CONSUMPTION TABLE 1. DATA OVERVIEW ================ sugov-noinv : non-invariant schedutil governor sugov-max : invariant schedutil, freq_max=max_boost sugov-mid : invariant schedutil, freq_max=midpoint sugov-P0 : invariant schedutil, freq_max=max_P perfgov : performance governor driver : acpi_cpufreq machine : AMD EPYC 7742 (Zen2, aka "Rome"), dual socket, 128 cores / 256 threads, SATA SSD storage, 250G of memory, XFS filesystem Benchmarks are described in the next section. Tilde (~) means the value is the same as baseline. Signed-off-by: Peter Zijlstra (Intel) Link: https://lkml.kernel.org/r/20201112182614.10700-3-ggherdovich@suse.cz --- arch/x86/kernel/smpboot.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c index a4ab5cf..c5dd5f6 100644 --- a/arch/x86/kernel/smpboot.c +++ b/arch/x86/kernel/smpboot.c @@ -2054,6 +2054,8 @@ static bool amd_set_max_freq_ratio(void) } perf_ratio = div_u64(highest_perf * SCHED_CAPACITY_SCALE, nominal_perf); + /* midpoint between max_boost and max_P */ + perf_ratio = (perf_ratio + SCHED_CAPACITY_SCALE) >> 1; if (!perf_ratio) { pr_debug("Non-zero highest/nominal perf values led to a 0 ratio\n"); return false;