Received: by 10.223.164.202 with SMTP id h10csp61080wrb; Thu, 9 Nov 2017 02:46:10 -0800 (PST) X-Google-Smtp-Source: ABhQp+RsELmZQm0GvPxdrCpwyZ3X44NJiikwrGDhX9YoX2IGMmSU7TCLXchXEfWHqceydJ7B1ver X-Received: by 10.84.217.93 with SMTP id e29mr18928plj.223.1510224370082; Thu, 09 Nov 2017 02:46:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1510224370; cv=none; d=google.com; s=arc-20160816; b=0wkG/+FKUACEdnO3yUG9OBowsPWJL0I/J1cPKc7mutBnqj22nSR/lY3VBQ3j+gEmzQ nvHWrg46dWs8ka1NMKqEm2zRxNs9sG86OY2MV9SZ3lGW436Hzuk2eMkyaHAAVB2an/5l 6ICSk5ouC4Y/WIHLJcUEdXU/fBzVP1/yEjOrimpFd7jw+qfwdkd/jN2gLo7P2JQe6wod RUJfyp5bA0Ok9aGOuc6FArNw8PweE8/39fA55D7edkq/1yOX/3IhDm128nGmktgCzir/ 76/fyeaenxompMtmGyUB4vkaJKvKUT0LgWeXM96fGnidY/PCWfHnq6RJdKbsDHSblOST ji6g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :arc-authentication-results; bh=yyFQFFcmYPz58WJtkTwx7Y6++4F3xlaU+6195dlV00c=; b=cAJx2HSa9AwhlVRKF+DPSw4UJ/G418tpu+JISJxdf1bEl3MaDoWS2LWQNt40uOBE4W ukGvweXtw9gJIXFBcGn9CAyCY101+QztGRpTlT1hrp3FP9dLPHpA50EKX+nLeeYAZJBd lLNp4EE13Uaro5/zV0puv8FZDKCsOAc1XwyEg1+4ZwOCq1NoJROcahYyUFEBYCXehBYk /xT5pUbsD6zAPwQytyUP/60jVmZocnWO1iqgO54qqkHk78bH45nBLcfyY6hKGpllUyxu pr9ro9Hc7aPdoUKJUV9BF9KIeHzv8vTkGIJqrTM53mqW/q0ZNHv07AnkbUmPi97zCTlL 1lpA== ARC-Authentication-Results: i=1; mx.google.com; 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=ucloud.cn Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e1si6075530pln.764.2017.11.09.02.45.59; Thu, 09 Nov 2017 02:46:10 -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; 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=ucloud.cn Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752772AbdKIKp0 (ORCPT + 81 others); Thu, 9 Nov 2017 05:45:26 -0500 Received: from m97138.mail.qiye.163.com ([220.181.97.138]:57203 "EHLO m97138.mail.qiye.163.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751020AbdKIKpY (ORCPT ); Thu, 9 Nov 2017 05:45:24 -0500 X-Greylist: delayed 376 seconds by postgrey-1.27 at vger.kernel.org; Thu, 09 Nov 2017 05:45:23 EST Received: from localhost (unknown [106.38.57.250]) by smtp9 (Coremail) with SMTP id u+CowABXHA4lMARaKmQNAA--.2S3; Thu, 09 Nov 2017 18:38:29 +0800 (CST) From: WANG Chao To: linux-kernel@vger.kernel.org Cc: Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" , Vikas Shivappa , "Rafael J. Wysocki" , Kate Stewart , Len Brown , Greg Kroah-Hartman , Philippe Ombredanne , Mathias Krause , x86@kernel.org, stable@kernel.org Subject: [PATCH] x86: use cpufreq_quick_get() for /proc/cpuinfo "cpu MHz" again Date: Thu, 9 Nov 2017 18:38:14 +0800 Message-Id: <20171109103814.70688-1-chao.wang@ucloud.cn> X-Mailer: git-send-email 2.15.0 X-CM-TRANSID: u+CowABXHA4lMARaKmQNAA--.2S3 X-Coremail-Antispam: 1Uf129KBjDUn29KB7ZKAUJUUUUU529EdanIXcx71UUUUU7v73 VFW2AGmfu7bjvjm3AaLaJ3UbIYCTnIWIevJa73UjIFyTuYvjfUkWv3UUUUU X-Originating-IP: [106.38.57.250] X-CM-SenderInfo: pfkd0hpzdqwq5xfo03fgof0/1tbiZwWLVFlZthA3FQAAs5 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit 941f5f0f6ef5 (x86: CPU: Fix up "cpu MHz" in /proc/cpuinfo) caused a serious performance issue when reading from /proc/cpuinfo on system with aperfmperf. For each cpu, arch_freq_get_on_cpu() sleeps 20ms to get its frequency. On a system with 64 cpus, it takes 1.5s to finish running `cat /proc/cpuinfo`, while it previously was done in 15ms. Some programs use /proc/cpuinfo during startup or runtime, eg. QEMU. This patch will restore the previous behavior and let user space happy. Fixes: 941f5f0f6ef5 (x86: CPU: Fix up "cpu MHz" in /proc/cpuinfo) Cc: stable@kernel.org # 4.13 Signed-off-by: WANG Chao --- arch/x86/kernel/cpu/Makefile | 2 +- arch/x86/kernel/cpu/proc.c | 4 +--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/arch/x86/kernel/cpu/Makefile b/arch/x86/kernel/cpu/Makefile index 236999c54edc..c60922a66385 100644 --- a/arch/x86/kernel/cpu/Makefile +++ b/arch/x86/kernel/cpu/Makefile @@ -22,7 +22,7 @@ obj-y += common.o obj-y += rdrand.o obj-y += match.o obj-y += bugs.o -obj-y += aperfmperf.o +obj-$(CONFIG_CPU_FREQ) += aperfmperf.o obj-$(CONFIG_PROC_FS) += proc.o obj-$(CONFIG_X86_FEATURE_NAMES) += capflags.o powerflags.o diff --git a/arch/x86/kernel/cpu/proc.c b/arch/x86/kernel/cpu/proc.c index 4378a729b933..6b7e17bf0b71 100644 --- a/arch/x86/kernel/cpu/proc.c +++ b/arch/x86/kernel/cpu/proc.c @@ -78,10 +78,8 @@ static int show_cpuinfo(struct seq_file *m, void *v) seq_printf(m, "microcode\t: 0x%x\n", c->microcode); if (cpu_has(c, X86_FEATURE_TSC)) { - unsigned int freq = arch_freq_get_on_cpu(cpu); + unsigned int freq = cpufreq_quick_get(cpu); - if (!freq) - freq = cpufreq_quick_get(cpu); if (!freq) freq = cpu_khz; seq_printf(m, "cpu MHz\t\t: %u.%03u\n", -- 2.15.0 From 1584073693492272102@xxx Tue Nov 14 20:13:16 +0000 2017 X-GM-THRID: 1584073693492272102 X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread