AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / ubuntu / 问题 / 1141157
Accepted
WarrenFaith
WarrenFaith
Asked: 2019-05-08 00:13:34 +0800 CST2019-05-08 00:13:34 +0800 CST 2019-05-08 00:13:34 +0800 CST

CPU调控器在负载下自动更改为“性能”

  • 772

我有一台带有 Xubuntu 18.04 LTS 的联想 T570。我目前的问题是我的 cpu 速度步进有点发疯,并且做了它认为最好的事情。

示例:当我运行我的 IDE 并且在构建期间 CPU 负载增加时,调控器会自动更改。我在编译我的项目期间通过以下调用抓住了这一刻:

martin@martin-ThinkPad-T570:~$ while cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor; do sleep 1; done
powersave
powersave
performance
performance

cpufreq-info 告诉我这个:

martin@martin-ThinkPad-T570:~$ cpufreq-info 
cpufrequtils 008: cpufreq-info (C) Dominik Brodowski 2004-2009
Report errors and bugs to [email protected], please.
analyzing CPU 0:
  driver: intel_pstate
  CPUs which run at the same hardware frequency: 0
  CPUs which need to have their frequency coordinated by software: 0
  maximum transition latency: 4294.55 ms.
  hardware limits: 400 MHz - 3.50 GHz
  available cpufreq governors: performance, powersave
  current policy: frequency should be within 3.50 GHz and 3.50 GHz.
                  The governor "performance" may decide which speed to use
                  within this range.
  current CPU frequency is 3.25 GHz.
analyzing CPU 1:
  driver: intel_pstate
  CPUs which run at the same hardware frequency: 1
  CPUs which need to have their frequency coordinated by software: 1
  maximum transition latency: 4294.55 ms.
  hardware limits: 400 MHz - 3.50 GHz
  available cpufreq governors: performance, powersave
  current policy: frequency should be within 3.50 GHz and 3.50 GHz.
                  The governor "performance" may decide which speed to use
                  within this range.
  current CPU frequency is 3.36 GHz.
analyzing CPU 2:
  driver: intel_pstate
  CPUs which run at the same hardware frequency: 2
  CPUs which need to have their frequency coordinated by software: 2
  maximum transition latency: 4294.55 ms.
  hardware limits: 400 MHz - 3.50 GHz
  available cpufreq governors: performance, powersave
  current policy: frequency should be within 3.50 GHz and 3.50 GHz.
                  The governor "performance" may decide which speed to use
                  within this range.
  current CPU frequency is 3.26 GHz.
analyzing CPU 3:
  driver: intel_pstate
  CPUs which run at the same hardware frequency: 3
  CPUs which need to have their frequency coordinated by software: 3
  maximum transition latency: 4294.55 ms.
  hardware limits: 400 MHz - 3.50 GHz
  available cpufreq governors: performance, powersave
  current policy: frequency should be within 3.50 GHz and 3.50 GHz.
                  The governor "performance" may decide which speed to use
                  within this range.
  current CPU frequency is 3.36 GHz.

请看一下

当前政策:频率应在 3.50 GHz 和 3.50 GHz 之间。调速器“性能”可以决定使用哪种速度

之后回到 powersave 我使用我的小脚本:

martin@martin-ThinkPad-T570:~$ cat cpu_freq_save.sh 
#!/bin/bash
sudo cpufreq-set -g powersave -c 0 --min 400MHz
sudo cpufreq-set -g powersave -c 1 --min 400MHz
sudo cpufreq-set -g powersave -c 2 --min 400MHz
sudo cpufreq-set -g powersave -c 3 --min 400MHz

这会重置最小频率和调速器,但只要我每次使用我的 IDE 再次编译调速器和最小频率再次更改时。

知道如何禁用该自动更改吗?

PS:如果您需要更多详细信息,请告诉我在哪里可以找到它们,我会提供

performance xubuntu cpu governor
  • 3 3 个回答
  • 2210 Views

3 个回答

  • Voted
  1. WarrenFaith
    2019-05-11T04:36:03+08:002019-05-11T04:36:03+08:00

    我玩了很多不同的东西,最终cpufreqd从我的系统中删除,只留下cpufrequtils安装和繁荣,它不再在负载时切换调速器。

    以下内容还将删除您的配置文件,因此如果您计划将来cpufreqd可能重新安装,请备份它们。cpufreqd

    sudo apt purge cpufreqd
    

    改变应该是立竿见影的。将调速器设置为省电后,使用:

    sudo cpupower frequency-set -g powersave
    

    重载后,调速器将不再切换到性能。

    • 2
  2. Best Answer
    WinEunuuchs2Unix
    2019-05-11T19:09:43+08:002019-05-11T19:09:43+08:00

    cpufreqd是一个频率管理守护进程,安装有:

    sudo apt install cpufreqd
    

    配置文件cpufreqd.conf用于更改频率。有两个部分您可以看到它将调控器更改为“性能”:

    [Profile]
    name=hi_boost
    minfreq=0%
    maxfreq=100%
    policy=performance
    
    # full power when AC
    [Rule]
    name=AC_on
    ac=on                   # (on/off)
    profile=hi_boost
    

    除非拔掉电池充电器,否则很难弄清楚它何时变为“省电”。

    由于内核 3.4 cpufreq内置于内核并自动加载。它包括频率管理守护进程,称为thermald. 因此,不再需要太多cpufreqd了,它可能在您的系统上发生了冲突。

    为了在电池供电下进行更大程度的定制,如今tlp通常使用该包装。

    • 2
  3. Elder Geek
    2019-05-11T11:31:06+08:002019-05-11T11:31:06+08:00

    如果您打算禁用 intel_pstate 驱动程序,您可以在启动时使用内核 arg 执行此操作intel_pstate=disable

    这可能不符合您的最佳利益,因为 intel_pstate 驱动程序了解 CPU 工作方式的详细信息,并且它比通用 ACPI 解决方案做得更好。英特尔声称 intel_pstate “powersave”比具有“性能”的通用 acpi 调控器更快,这可能是因为执行某些具有更高频率的任务将消耗更少的功率,而不是需要更多时间的较低频率,例如算术东西,但并非对所有任务都是如此例如从内存中加载一些东西。

    你能做的最好的事情就是忽略它,让 intel_pstate 驱动程序完成它的工作,允许使用内置在芯片中的TurboBoost 技术,它会根据额定功率、额定温度和电流限制自动调整频率

    对于当代英特尔处理器,例如您似乎拥有的Core i5 7300U(尽管您没有提及型号),频率由处理器本身控制,并且暴露于软件的 P 状态与性能水平有关。频率可以设置为单一频率的想法是英特尔酷睿处理器的虚构。即使缩放驱动程序选择单个 P 状态,处理器运行的实际频率也是由处理器本身选择的。

    资料来源:

    https://unix.stackexchange.com/questions/121410/setting-cpu-governor-to-on-demand-or-conservative

    https://www.cnet.com/products/lenovo-thinkpad-t570-15-6-core-i5-7300u-8-gb-ram-256-gb-ssd-20h9000uus/

    https://en.wikichip.org/wiki/intel/core_i5/i5-7300u

    • 1

相关问题

  • 如何优化 SSD 的操作系统?

  • 如果有空闲 RAM,如何清空交换?

  • 为什么 Flash 应用程序如此缓慢/崩溃?

  • 上网本版电池寿命 - Ubuntu 与 Kubuntu?

  • 如果在服务器机器上运行 Ubuntu 桌面版,性能损失是多少?

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    如何运行 .sh 脚本?

    • 16 个回答
  • Marko Smith

    如何安装 .tar.gz(或 .tar.bz2)文件?

    • 14 个回答
  • Marko Smith

    如何列出所有已安装的软件包

    • 24 个回答
  • Marko Smith

    无法锁定管理目录 (/var/lib/dpkg/) 是另一个进程在使用它吗?

    • 25 个回答
  • Martin Hope
    Flimm 如何在没有 sudo 的情况下使用 docker? 2014-06-07 00:17:43 +0800 CST
  • Martin Hope
    Ivan 如何列出所有已安装的软件包 2010-12-17 18:08:49 +0800 CST
  • Martin Hope
    La Ode Adam Saputra 无法锁定管理目录 (/var/lib/dpkg/) 是另一个进程在使用它吗? 2010-11-30 18:12:48 +0800 CST
  • Martin Hope
    David Barry 如何从命令行确定目录(文件夹)的总大小? 2010-08-06 10:20:23 +0800 CST
  • Martin Hope
    jfoucher “以下软件包已被保留:”为什么以及如何解决? 2010-08-01 13:59:22 +0800 CST
  • Martin Hope
    David Ashford 如何删除 PPA? 2010-07-30 01:09:42 +0800 CST

热门标签

10.10 10.04 gnome networking server command-line package-management software-recommendation sound xorg

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve