KPTI Meltdown Linux 内核修复对性能的影响

KPTI Meltdown Linux 内核修复对性能的影响

因此,我最近(2018 年 1 月上旬)收到了我的 Fedora 26 笔记本电脑的内核更新,其中包括 KPTI 内核修复程序,该修复程序纠正了崩溃错误。我听到了很多关于这些修复对 Linux 系统影响的猜测;确实英特尔似乎相信皇帝仍然衣着整齐。从该链接中可以看出,业内的一些消息来源(特别是苹果、微软、亚马逊和谷歌)声称影响可以忽略不计。这个链接。其他的声称影响巨大

我不满足于媒体报道中的混乱,我想知道“这对我的机器有何真正影响?”我问。理论上,受 CPU 限制的进程的影响可以忽略不计,而执行大量系统调用(例如磁盘或网络 I/O)的进程会受到更大的影响。

我在下面回答自己。

PS:我还没有看到更现代处理器的基准测试;那将是非常有趣的是,正如我听说的那样“……较新的处理器并没有造成巨大的损失。”那些处理器是哪些,“不是很大”到什么程度才不算“很大”?我有一台较旧的 Lenovo Thinkpad T430S,配有 Intel i5-3210m 双核(每核 2 个线程)处理器。关于 Meltdown 及其修复,这是否现代?据微软称,“……(它)表示,配备 2015 年或更早版本处理器、运行 Windows 7、8 和 10 的消费设备更有可能出现速度下降的情况。”但英特尔的自己的基准测试似乎没有显示 2015 年和 2017 年处理器之间的差异

答案1

在启动新内核之前,我想获得一些实数。我将内核从 4.14.8 升级到 4.14.11。后者包括针对 Meltdown 漏洞的 KPTI 修复。我有一台较旧的 Lenovo Thinkpad T430S,配有 Intel i5-3210m 双核(每核 2 个线程)处理器。结果很有趣,所以我想我应该将它们发布在这里。

我执行了三个基准测试:

结果如下。除了一些令人惊讶的值(辅助循环/秒和目录操作 AIM9 基准测试、块顺序输出 bonnie++ 基准测试都显示出更好的性能)之外,系统似乎受到了一些打击。我发现 gcc 编译相当有趣,因为编译还涉及大量文件 i/o 和 CPU 操作。这些事情与我经常在我的机器上执行的任务类似。无论如何,这 3 组基准测试似乎都同意一件事:自从安装 KPTI Meltdown 修复内核以来,我的系统通常受到了可衡量的打击 - 甚至整数和浮点运算也是如此。原本需要 160 分钟的 gcc 编译现在只需要 172 分钟。真糟糕。

AIM9 benchmark
AIM Independent Resource Benchmark - Suite IX v1.1, January 22, 1996
Copyright (c) 1996 - 2001 Caldera International, Inc.
All Rights Reserved

BEFORE:
Machine's name                                    : rodin
Machine's configuration                           : kernel_4.14.8-200
Number of seconds to run each test [2 to 1000]    : 10
Path to disk files                                : /var/tmp/aim9

AFTER:
Machine's name                                    : rodin
Machine's configuration                           : kernel_4.14.11-200
Number of seconds to run each test [2 to 1000]    : 10
Path to disk files                                : /var/tmp/aim9

注意:AIM9 基准测试有一个错误,编译时将不允许完成其中一项测试。为了让它运行,我必须更改 creat-clo.c 上的第 97 行:

static int sigcount;           /* count of signals */

对此:

volatile static int sigcount;           /* count of signals */

以下是我的基准测试结果:

AIM9 Benchmark
         BEFORE        AFTER Percent Change   Description
01      1.996 M      1.929 M   -3.34 Thousand Double Precision Additions/second
02      1.980 M      1.945 M   -1.75 Thousand Single Precision Additions/second
03      8.559 M      8.259 M   -3.50 Thousand Long Integer Additions/second
04      8.592 M      8.280 M   -3.63 Thousand Integer Additions/second
05      8.599 M      8.268 M   -3.85 Thousand Short Integer Additions/second
06    205400.00    190400.00   -7.30 File Creations and Closes/second
07    552330.00    384665.33  -30.35 System Allocations & Pages/second
08      2.844 M      1.373 M  -51.71 System Memory Allocations/second
09     75.980 M     74.623 M   -1.78 Non-local gotos/second
10      1.131 M    651400.00  -42.43 Signal Traps/second
11       855.64       787.71   -7.93 Program Loads/second
12      3246.75      3846.15   18.46 Task Creations/second
13    166307.40    154135.80   -7.31 Link/Unlink Pairs/second
14    504839.16    369664.00  -26.77 Random Disk Reads (K)/second
15    451072.00    339628.37  -24.70 Random Disk Writes (K)/second
16      3.285 M      1.765 M  -46.24 Sequential Disk Reads (K)/second
17    698880.00    598528.00  -14.35 Sequential Disk Writes (K)/second
18    537088.00    431616.00  -19.63 Disk Copies (K)/second
19       115.78       116.58     .69 Sync Random Disk Writes (K)/second
20       116.42       114.75   -1.43 Sync Sequential Disk Writes (K)/second
21       116.05       114.90    -.99 Sync Disk Copies (K)/second
22     79020.00     73711.29   -6.71 Directory Searches/second
23    311100.00    299400.00   -3.76 Thousand Double Precision Divides/second
24    316483.52    305694.31   -3.40 Thousand Single Precision Divides/second
25    105284.72    101688.31   -3.41 Thousand Long Integer Divides/second
26    294660.00    286470.00   -2.77 Thousand Integer Divides/second
27    290700.00    282420.00   -2.84 Thousand Short Integer Divides/second
28    424.140 M    407.756 M   -3.86 Function Calls (no arguments)/second
29    462.336 M    448.460 M   -3.00 Function Calls (1 argument)/second
30    485.198 M    472.115 M   -2.69 Function Calls (2 arguments)/second
31    236.441 M    226.969 M   -4.00 Function Calls (15 arguments)/second
32       195.30       186.63   -4.43 Integer Sieves/second
33      1.202 M      1.160 M   -3.48 Thousand Double Precision Multiplies/second
34      1.204 M      1.166 M   -3.18 Thousand Single Precision Multiplies/second
35      1.396 M      1.359 M   -2.69 Thousand Long Integer Multiplies/second
36      1.396 M      1.357 M   -2.83 Thousand Integer Multiplies/second
37      1.365 M      1.327 M   -2.78 Thousand Short Integer Multiplies/second
38    554540.00    538080.00   -2.96 Numeric Functions/second
39      1.614 M      1.561 M   -3.28 Zeros Found/second
40      2.513 M      2.431 M   -3.28 Trigonometric Functions/second
41     18.605 M     17.861 M   -4.00 Point Transformations/second
42      3880.00      3766.00   -2.93 Linear Systems Solved/second
43     28060.00     26980.00   -3.84 String Manipulations/second
44     14.751 M     14.373 M   -2.55 Dynamic Memory Operations/second
46      5277.00      5121.00   -2.95 Sort Operations/second
47      4231.00     10771.00  154.57 Auxiliary Loops/second
48      2.828 M      2.900 M    2.54 Directory Operations/second
49       137.36       156.70   14.07 Shell Scripts/second
50       137.16       157.64   14.93 Shell Scripts/second
51       137.60       161.90   17.65 Shell Scripts/second
52     44.497 M     42.774 M   -3.87 Series Evaluations/second
53      1.092 M    607030.00  -44.43 Shared Memory Operations/second
56      1.318 M    825670.00  -37.38 FIFO Messages/second
57    922370.00    664690.00  -27.93 Stream Pipe Messages/second
58    866290.00    632950.00  -26.93 DataGram Pipe Messages/second
59      1.922 M      1.038 M  -45.96 Pipe Messages/second
60  19725.935 M  18947.483 M   -3.94 Memory to Memory Copy/second

=========================================================================================================
GCC compile, both "configure" and "make"
Results summary::
configure: 38% real slowdown

make (x86_64 only): 7.7% real slowdown, 5.5% user CPU slowdown

    BEFORE                                         AFTER
time ../gcc-7.2.0/configure --disable-multilib | time ../gcc-7.2.0/configure --disable-multilib
 ...                                           | ...   
configure: creating ./config.status            | configure: creating ./config.status
config.status: creating Makefile               | config.status: creating Makefile
                                               |
real    0m2.467s                               | real    0m3.420s      
user    0m1.835s                               | user    0m1.936s      
sys     0m1.108s                               | sys     0m1.295s      
                                               |
time make                                      | time make
...                                            | ...     
real    160m8.766s                             | real    172m28.158s
user    152m11.430s                            | user    163m34.790s      
sys     6m41.507s                              | sys     7m5.214s     

=========================================================================================================
BONNIE++
Version: 1.97
See https://www.coker.com.au/bonnie++/experimental/ . This version was provided by my Fedora distribution.

Run using: bonnie++ -n 1024

Sample results:
                                BEFORE          AFTER           % change from before
Sequential Output, per char     1115 K/s        890 K/s         -20
Sequential Output, block        358891 K/s      461208 K/s      +28
Sequential Input, per char      4181 K/s        1989 K/s        -52
Sequential Input, block         515347 K/s      521646 K/s      -1,2
Random Seeks                    5651 /s         5221 /s         -7.6
Sequential Create, Create       41855 /s        40751 /s        -2.74
                   Read         741945 /s       624554 /s       -15.8
                   Delete       79832 / s       78340 /s        -1.9
Random Create,     Create       41198 /s        41003 /s        -0.47
                   Read         741945 /s       719494 /s       -3.02
                   Delete       61154 /s        60698 /s        -0.74

邦妮结果可在以下位置获取:

前: https://bintray.com/greygnome/generic/download_file?file_path=bon_results_before_kpti.html

后: https://bintray.com/greygnome/generic/download_file?file_path=bon_results_after_kpti.html

相关内容