Skip to contentSkip to conversation

53f408cad0: stress-ng.sockfd.ops_per_sec 13.8% improvement

Internet Oliver Sang 2 participants 4 messages Aug 21, 2024 – Sep 4, 2024 2 messages not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): LV3PR11MB850757DC8FEF98852AF804F49D8E2@LV3PR11MB8507.namprd11.prod.outlook.com

#2 lore raw

Thanks aurelianliu(刘诗) and Wu!

this could be a code alignment issue. we will check further and update you.

Quoted 195 lines · Wu
Quoted 1 line

Push pending hrtimers away from outgoing CPU earlier,测试过程中,如果没有

hotplug,是不是不应该有性能变化

查看了一下代码,确实应该只有在cpu hotplug的时候,才会运行patch中修改的代码。

不过,在patch中新增加了对cpu状态CPUHP_AP_HRTIMERS_DYING的一个handle,

是否这个improving performance的原因。

另外,和Oliver对过了,这个improving的data应该是多次测试后的结果。

Best Regards

Zheng Wu

From: aurelianliu(刘诗) <[email protected]>
Sent: Tuesday, August 20, 2024 4:24 PM
To: Sang, Oliver <[email protected]>; jasperwang(王佳) <[email protected]>; kaixuxia(夏开旭) <[email protected]>; Liu, Frank <[email protected]>; kasong(宋恺睿) <[email protected]>; Chen, Saga <[email protected]>; kernelxing(邢万里) <[email protected]>; deshengwu (吴德胜) <[email protected]>; flyingpeng(彭浩) <[email protected]>; Zeng, Jason <[email protected]>; Zheng, Wu <[email protected]>; Jia, Yingbao <[email protected]>; Jia, Pei P <[email protected]>
Cc: oe-lkp <[email protected]>; lkp <[email protected]>; Sang, Oliver <[email protected]>
Subject: 回复:[Internet][opencloudos:next] [hrtimers] 53f408cad0:
stress-ng.sockfd.ops_per_sec 13.8% improvement

这里有一个疑问:

Push pending hrtimers away from outgoing CPU earlier,测试过程中,如果没有 hotplug,是不是不应该有性能变化

Sang, Oliver<[email protected]> 在 2024年8月20日周二 16:09 写道:

Hello,

kernel test robot noticed a 13.8% improvement of stress-ng.sockfd.ops_per_sec on:

commit: 53f408cad05bb987af860af22f4151e5a18e6ee8 ("hrtimers: Push pending hrtimers away from outgoing CPU earlier")
https://gitee.com/OpenCloudOS/OpenCloudOS-Kernel.git next

testcase: stress-ng
test machine: 256 threads 4 sockets INTEL(R) XEON(R) PLATINUM 8592+ (Emerald Rapids) with 256G memory
parameters:

nr_threads: 100%
testtime: 60s
test: sockfd
cpufreq_governor: performance

Details are as below:
-------------------------------------------------------------------------------------------------->

The kernel config and materials to reproduce are available at:
https://download.01.org/0day-ci/archive/20240820/
[email protected]

===============================================================================
==========
compiler/cpufreq_governor/kconfig/nr_threads/rootfs/tbox_group/test/testcase/ testtime:
gcc-12/performance/x86_64-oc_stream_base_config/100%/
debian-12-x86_64-20240206.cgz/lkp-emr-2sp1/sockfd/stress-ng/60s

commit:
c94c44685d ("scsi: sd: Fix sshdr use in sd_suspend_common()") 53f408cad0 ("hrtimers: Push pending hrtimers away from outgoing CPU earlier")

c94c44685d801334 53f408cad05bb987af860af22f4
---------------- ---------------------------

         %stddev     %change         %stddev
             \          |                \ 
     52019          +192.9%     152364 ±145%  vmstat.system.cs
    248.33 ±  7%     -19.9%     198.83 ± 16%  perf-c2c.DRAM.local
     11510 ±  2%     +20.0%      13813 ± 13%  perf-c2c.HITM.local
     25227           +17.0%      29523 ± 12%  perf-c2c.HITM.total
  46241536           +13.8%   52608779 ±  3%  stress-ng.sockfd.ops
    770583           +13.8%     876602 ±  3%  stress-ng.sockfd.ops_per_sec
    709901 ±  2%    +473.7%    4072397 ±177% 
stress-ng.time.voluntary_context_switches
   2221056            +4.0%    2309588        proc-vmstat.numa_hit
   1824201            +4.8%    1912626        proc-vmstat.numa_local
   3416606           +10.0%    3757450        proc-vmstat.pgalloc_normal
   2811184           +12.0%    3147390        proc-vmstat.pgfree
 1.646e+10            +3.2%  1.699e+10        perf-stat.i.branch-instructions
  41247621 ±  2%      +7.5%   44359189 ±  2%  perf-stat.i.cache-misses
  89628939           +11.4%   99819592 ±  2%  perf-stat.i.cache-references
     54186          +182.9%     153293 ±141%  perf-stat.i.context-switches
     10.31            -3.2%       9.98        perf-stat.i.cpi
      3124           +19.5%       3733 ± 12%  perf-stat.i.cpu-migrations
     18733            -7.2%      17380 ±  2% 
perf-stat.i.cycles-between-cache-misses
 7.027e+10            +3.9%  7.304e+10        perf-stat.i.instructions
      0.12            +3.0%       0.12        perf-stat.i.ipc
     10.43            -2.9%      10.13        perf-stat.overall.cpi
     17676 ±  2%      -5.7%      16664 ±  2% 
perf-stat.overall.cycles-between-cache-misses
      0.10            +3.0%       0.10        perf-stat.overall.ipc
 1.606e+10            +2.4%  1.645e+10        perf-stat.ps.branch-instructions
 4.528e+11 ±223%    +422.8%  2.367e+12 ± 82%  perf-stat.ps.branch-misses
  40486476 ±  2%      +6.2%   42992791 ±  2%  perf-stat.ps.cache-misses
  87229061           +10.7%   96531559 ±  2%  perf-stat.ps.cache-references
     52859          +194.7%     155786 ±145%  perf-stat.ps.context-switches
      3038           +16.6%       3543 ±  8%  perf-stat.ps.cpu-migrations
  6.86e+10            +3.1%   7.07e+10        perf-stat.ps.instructions
 4.235e+12            +2.5%   4.34e+12        perf-stat.total.instructions
      0.16 ±  3%      -0.1        0.09 ±  8% 
perf-profile.children.cycles-pp.free_uid
      0.22            -0.1        0.15 ±  9% 
perf-profile.children.cycles-pp.__scm_destroy
      0.15            -0.1        0.09 ±  8% 
perf-profile.children.cycles-pp.refcount_dec_not_one
      0.14 ±  3%      -0.0        0.10 ±  9% 
perf-profile.children.cycles-pp.scm_detach_fds
      0.16 ±  3%      -0.0        0.12 ±  9% 
perf-profile.children.cycles-pp.__scm_recv_common
      0.08            -0.0        0.05 ± 44% 
perf-profile.children.cycles-pp.scm_fp_dup
      0.14 ±  2%      -0.0        0.13 ±  2% 
perf-profile.children.cycles-pp.__scm_send
      0.11 ±  3%      +3.6        3.74 ±215% 
perf-profile.children.cycles-pp.do_dentry_open
      0.11 ±  3%      +3.6        3.74 ±215% 
perf-profile.children.cycles-pp.vfs_open
      0.06            +3.7        3.72 ±219% 
perf-profile.children.cycles-pp.____fput
      0.06            +3.7        3.72 ±219% 
perf-profile.children.cycles-pp.__fput
      0.08            +3.7        3.75 ±217% 
perf-profile.children.cycles-pp.syscall
      0.08            +3.7        3.75 ±217% 
perf-profile.children.cycles-pp.task_work_run
      0.18 ±  2%      +7.2        7.41 ±217% 
perf-profile.children.cycles-pp.do_open
      0.00            +7.3        7.28 ±222% 
perf-profile.children.cycles-pp.lockref_put_or_lock
      0.00            +7.3        7.29 ±221% 
perf-profile.children.cycles-pp.dput
      0.31           +10.8       11.13 ±216% 
perf-profile.children.cycles-pp.do_filp_open
      0.30           +10.8       11.13 ±216% 
perf-profile.children.cycles-pp.path_openat
      0.35           +10.8       11.18 ±216% 
perf-profile.children.cycles-pp.do_sys_openat2
      0.36           +10.8       11.19 ±215% 
perf-profile.children.cycles-pp.__x64_sys_openat
      0.39           +10.8       11.22 ±215% 
perf-profile.children.cycles-pp.open64
      0.15            -0.1        0.08 ±  8% 
perf-profile.self.cycles-pp.refcount_dec_not_one
      0.07            -0.0        0.05       
perf-profile.self.cycles-pp.__scm_send
     96.72            +0.1       96.81       

perf-profile.self.cycles-pp.native_queued_spin_lock_slowpath

Disclaimer:
Results have been estimated based on internal Intel analysis and are provided for informational purposes only. Any difference in system hardware or software design or configuration may affect actual performance.

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

SECURITY NOTE: file ~/.netrc must not be accessible by others

#3 lore raw
In reply to a message not in the archive

hi, all,

Quoted 10 lines · Wu
Quoted 1 line

Push pending hrtimers away from outgoing CPU earlier,测试过程中,如果没有

hotplug,是不是不应该有性能变化

查看了一下代码,确实应该只有在cpu hotplug的时候,才会运行patch中修改的代码。

不过,在patch中新增加了对cpu状态CPUHP_AP_HRTIMERS_DYING的一个handle,

是否这个improving performance的原因。

另外,和Oliver对过了,这个improving的data应该是多次测试后的结果。

Wu, you are right!
for original report, both 53f408cad0 and parent tested 6 times. (in fact, for all performance report from 0day, 6 is mininum run times for a commit)

the data for 53f408cad0:
"stress-ng.sockfd.ops_per_sec": [

    806893.21,   <--- one unstable data, but still distinct enough comparing to c94c44685d
    890668.75,
    890737.88,
    890370.42,
    888873.71,
    892069.45

],

the data for parent (c94c44685d):
"stress-ng.sockfd.ops_per_sec": [

    772950.12,
    774262.88,
    748388.34,
    774652.04,
    776115.25,
    777131.75

],

based on your feedback, we checked code alignment further. by attached patch from Feng Tang (Cced, our expert about code alignment issues, and is working on patch-set for mitigating this kind of issues, Thanks a lot, Feng!)

and we run tests up to 20 times for both commits, the performance difference is just in noise now. so the original report is less meaningful. sorry for any confusion caused.

below some details.

original 53f408cad0 and its parent looks like below in branch:

* 53f408cad05b hrtimers: Push pending hrtimers away from outgoing CPU earlier
* c94c44685d80 scsi: sd: Fix sshdr use in sd_suspend_common()
* dd3438abfb85 vdpa/mlx5: preserve CVQ vringh index

we inserted the code alignment patch from Feng before c94c44685d80, then the commits in branch became below:

* f8057ff406bab9 hrtimers: Push pending hrtimers away from outgoing CPU earlier
* 620c3bf8aa2f2e scsi: sd: Fix sshdr use in sd_suspend_common()
* 4fe88ea078d804 align kernel/exit.c <----- attached patch from Feng
* dd3438abfb85f6 vdpa/mlx5: preserve CVQ vringh index

then we run same test upon new f8057ff406bab9 and 620c3bf8aa2f2e up to 20 times

=========================================================================================
compiler/cpufreq_governor/kconfig/nr_threads/rootfs/tbox_group/test/testcase/testtime:
gcc-12/performance/x86_64-oc_stream_base_config/100%/debian-12-x86_64-20240206.cgz/lkp-emr-2sp1/sockfd/stress-ng/60s

commit:
620c3bf8aa2f2e ("scsi: sd: Fix sshdr use in sd_suspend_common()") f8057ff406bab9 ("hrtimers: Push pending hrtimers away from outgoing CPU earlier")

620c3bf8aa2f2e37 f8057ff406bab9ca3e6c19548fc
---------------- ---------------------------
fail:runs %reproduction fail:runs
| | |
20:20 0% 20:20 stress-ng.sockfd.pass
%stddev %change %stddev
\ | \

  53177039 ±  3%      -1.5%   52396229 ±  5%  stress-ng.sockfd.ops
    886042 ±  3%      -1.5%     873038 ±  5%  stress-ng.sockfd.ops_per_sec

also captured raw data as below FYI.

although there are random unstable data, generally speaking, there is no obvious performance difference between these 2 new commits now.

for f8057ff406bab9 (saw several not stable data):
"stress-ng.sockfd.ops_per_sec": [

    788846.43,   <---
    870181.86,
    800294.02,   <---
    897801.49,
    896612.93,
    894245.37,
    896740.75,
    894682.9,
    814902.28,   <---
    896683.88,
    896215.86,
    895695.55,
    895589.53,
    897497.99,
    895326.19,
    896870.11,
    897734.02,
    739848.46,   <---
    899569.27,
    895426.67

],

for 620c3bf8aa2f2e (there are also unstable data):
"stress-ng.sockfd.ops_per_sec": [

    896915.05,
    895960.77,
    896191.9,
    897573.54,
    897191.51,
    898619.02,
    902343.05,
    897126.19,
    887130.05,
    884084.2,
    804080.41,   <---
    896124.17,
    894256.43,
    898721.35,
    894504.22,
    897396.18,
    896682.74,
    894763.47,
    898041.33,
    793150.46    <---

],

Quoted 181 lines

Best Regards

Zheng Wu

From: aurelianliu(刘诗) <[email protected]>
Sent: Tuesday, August 20, 2024 4:24 PM
To: Sang, Oliver <[email protected]>; jasperwang(王佳) <[email protected]>; kaixuxia(夏开旭) <[email protected]>; Liu, Frank <[email protected]>; kasong(宋恺睿) <[email protected]>; Chen, Saga <[email protected]>; kernelxing(邢万里) <[email protected]>; deshengwu (吴德胜) <[email protected]>; flyingpeng(彭浩) <[email protected]>; Zeng, Jason <[email protected]>; Zheng, Wu <[email protected]>; Jia, Yingbao <[email protected]>; Jia, Pei P <[email protected]>
Cc: oe-lkp <[email protected]>; lkp <[email protected]>; Sang, Oliver <[email protected]>
Subject: 回复:[Internet][opencloudos:next] [hrtimers] 53f408cad0:
stress-ng.sockfd.ops_per_sec 13.8% improvement

这里有一个疑问:

Push pending hrtimers away from outgoing CPU earlier,测试过程中,如果没有 hotplug,是不是不应该有性能变化

Sang, Oliver<[email protected]> 在 2024年8月20日周二 16:09 写道:

Hello,

kernel test robot noticed a 13.8% improvement of stress-ng.sockfd.ops_per_sec on:

commit: 53f408cad05bb987af860af22f4151e5a18e6ee8 ("hrtimers: Push pending hrtimers away from outgoing CPU earlier")
https://gitee.com/OpenCloudOS/OpenCloudOS-Kernel.git next

testcase: stress-ng
test machine: 256 threads 4 sockets INTEL(R) XEON(R) PLATINUM 8592+ (Emerald Rapids) with 256G memory
parameters:

nr_threads: 100%
testtime: 60s
test: sockfd
cpufreq_governor: performance

Details are as below:
-------------------------------------------------------------------------------------------------->

The kernel config and materials to reproduce are available at:
https://download.01.org/0day-ci/archive/20240820/
[email protected]

===============================================================================
==========
compiler/cpufreq_governor/kconfig/nr_threads/rootfs/tbox_group/test/testcase/ testtime:
gcc-12/performance/x86_64-oc_stream_base_config/100%/
debian-12-x86_64-20240206.cgz/lkp-emr-2sp1/sockfd/stress-ng/60s

commit:
c94c44685d ("scsi: sd: Fix sshdr use in sd_suspend_common()") 53f408cad0 ("hrtimers: Push pending hrtimers away from outgoing CPU earlier")

c94c44685d801334 53f408cad05bb987af860af22f4
---------------- ---------------------------

         %stddev     %change         %stddev
             \          |                \ 
     52019          +192.9%     152364 ±145%  vmstat.system.cs
    248.33 ±  7%     -19.9%     198.83 ± 16%  perf-c2c.DRAM.local
     11510 ±  2%     +20.0%      13813 ± 13%  perf-c2c.HITM.local
     25227           +17.0%      29523 ± 12%  perf-c2c.HITM.total
  46241536           +13.8%   52608779 ±  3%  stress-ng.sockfd.ops
    770583           +13.8%     876602 ±  3%  stress-ng.sockfd.ops_per_sec
    709901 ±  2%    +473.7%    4072397 ±177% 
stress-ng.time.voluntary_context_switches
   2221056            +4.0%    2309588        proc-vmstat.numa_hit
   1824201            +4.8%    1912626        proc-vmstat.numa_local
   3416606           +10.0%    3757450        proc-vmstat.pgalloc_normal
   2811184           +12.0%    3147390        proc-vmstat.pgfree
 1.646e+10            +3.2%  1.699e+10        perf-stat.i.branch-instructions
  41247621 ±  2%      +7.5%   44359189 ±  2%  perf-stat.i.cache-misses
  89628939           +11.4%   99819592 ±  2%  perf-stat.i.cache-references
     54186          +182.9%     153293 ±141%  perf-stat.i.context-switches
     10.31            -3.2%       9.98        perf-stat.i.cpi
      3124           +19.5%       3733 ± 12%  perf-stat.i.cpu-migrations
     18733            -7.2%      17380 ±  2% 
perf-stat.i.cycles-between-cache-misses
 7.027e+10            +3.9%  7.304e+10        perf-stat.i.instructions
      0.12            +3.0%       0.12        perf-stat.i.ipc
     10.43            -2.9%      10.13        perf-stat.overall.cpi
     17676 ±  2%      -5.7%      16664 ±  2% 
perf-stat.overall.cycles-between-cache-misses
      0.10            +3.0%       0.10        perf-stat.overall.ipc
 1.606e+10            +2.4%  1.645e+10        perf-stat.ps.branch-instructions
 4.528e+11 ±223%    +422.8%  2.367e+12 ± 82%  perf-stat.ps.branch-misses
  40486476 ±  2%      +6.2%   42992791 ±  2%  perf-stat.ps.cache-misses
  87229061           +10.7%   96531559 ±  2%  perf-stat.ps.cache-references
     52859          +194.7%     155786 ±145%  perf-stat.ps.context-switches
      3038           +16.6%       3543 ±  8%  perf-stat.ps.cpu-migrations
  6.86e+10            +3.1%   7.07e+10        perf-stat.ps.instructions
 4.235e+12            +2.5%   4.34e+12        perf-stat.total.instructions
      0.16 ±  3%      -0.1        0.09 ±  8% 
perf-profile.children.cycles-pp.free_uid
      0.22            -0.1        0.15 ±  9% 
perf-profile.children.cycles-pp.__scm_destroy
      0.15            -0.1        0.09 ±  8% 
perf-profile.children.cycles-pp.refcount_dec_not_one
      0.14 ±  3%      -0.0        0.10 ±  9% 
perf-profile.children.cycles-pp.scm_detach_fds
      0.16 ±  3%      -0.0        0.12 ±  9% 
perf-profile.children.cycles-pp.__scm_recv_common
      0.08            -0.0        0.05 ± 44% 
perf-profile.children.cycles-pp.scm_fp_dup
      0.14 ±  2%      -0.0        0.13 ±  2% 
perf-profile.children.cycles-pp.__scm_send
      0.11 ±  3%      +3.6        3.74 ±215% 
perf-profile.children.cycles-pp.do_dentry_open
      0.11 ±  3%      +3.6        3.74 ±215% 
perf-profile.children.cycles-pp.vfs_open
      0.06            +3.7        3.72 ±219% 
perf-profile.children.cycles-pp.____fput
      0.06            +3.7        3.72 ±219% 
perf-profile.children.cycles-pp.__fput
      0.08            +3.7        3.75 ±217% 
perf-profile.children.cycles-pp.syscall
      0.08            +3.7        3.75 ±217% 
perf-profile.children.cycles-pp.task_work_run
      0.18 ±  2%      +7.2        7.41 ±217% 
perf-profile.children.cycles-pp.do_open
      0.00            +7.3        7.28 ±222% 
perf-profile.children.cycles-pp.lockref_put_or_lock
      0.00            +7.3        7.29 ±221% 
perf-profile.children.cycles-pp.dput
      0.31           +10.8       11.13 ±216% 
perf-profile.children.cycles-pp.do_filp_open
      0.30           +10.8       11.13 ±216% 
perf-profile.children.cycles-pp.path_openat
      0.35           +10.8       11.18 ±216% 
perf-profile.children.cycles-pp.do_sys_openat2
      0.36           +10.8       11.19 ±215% 
perf-profile.children.cycles-pp.__x64_sys_openat
      0.39           +10.8       11.22 ±215% 
perf-profile.children.cycles-pp.open64
      0.15            -0.1        0.08 ±  8% 
perf-profile.self.cycles-pp.refcount_dec_not_one
      0.07            -0.0        0.05       
perf-profile.self.cycles-pp.__scm_send
     96.72            +0.1       96.81       

perf-profile.self.cycles-pp.native_queued_spin_lock_slowpath

Disclaimer:
Results have been estimated based on internal Intel analysis and are provided for informational purposes only. Any difference in system hardware or software design or configuration may affect actual performance.

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

SECURITY NOTE: file ~/.netrc must not be accessible by others

#4 lore raw
Quoted 47 lines · Oliver Sang

hi, all,

Quoted 10 lines · Wu
Quoted 1 line

Push pending hrtimers away from outgoing CPU earlier,测试过程中,如果没有

hotplug,是不是不应该有性能变化

查看了一下代码,确实应该只有在cpu hotplug的时候,才会运行patch中修改的代码。

不过,在patch中新增加了对cpu状态CPUHP_AP_HRTIMERS_DYING的一个handle,

是否这个improving performance的原因。

另外,和Oliver对过了,这个improving的data应该是多次测试后的结果。

Wu, you are right!
for original report, both 53f408cad0 and parent tested 6 times. (in fact, for all performance report from 0day, 6 is mininum run times for a commit)

the data for 53f408cad0:
"stress-ng.sockfd.ops_per_sec": [

    806893.21,   <--- one unstable data, but still distinct enough comparing to c94c44685d
    890668.75,
    890737.88,
    890370.42,
    888873.71,
    892069.45

],

the data for parent (c94c44685d):
"stress-ng.sockfd.ops_per_sec": [

    772950.12,
    774262.88,
    748388.34,
    774652.04,
    776115.25,
    777131.75

],

based on your feedback, we checked code alignment further. by attached patch from Feng Tang (Cced, our expert about code alignment issues, and is working on patch-set for mitigating this kind of issues, Thanks a lot, Feng!)

and we run tests up to 20 times for both commits, the performance difference is just in noise now. so the original report is less meaningful. sorry for any confusion caused.

[...]

Quoted 17 lines

=========================================================================================
compiler/cpufreq_governor/kconfig/nr_threads/rootfs/tbox_group/test/testcase/testtime:
gcc-12/performance/x86_64-oc_stream_base_config/100%/debian-12-x86_64-20240206.cgz/lkp-emr-2sp1/sockfd/stress-ng/60s

commit:
620c3bf8aa2f2e ("scsi: sd: Fix sshdr use in sd_suspend_common()") f8057ff406bab9 ("hrtimers: Push pending hrtimers away from outgoing CPU earlier")

620c3bf8aa2f2e37 f8057ff406bab9ca3e6c19548fc
---------------- ---------------------------
fail:runs %reproduction fail:runs
| | |
20:20 0% 20:20 stress-ng.sockfd.pass
%stddev %change %stddev
\ | \

Quoted 8 lines
  53177039 ±  3%      -1.5%   52396229 ±  5%  stress-ng.sockfd.ops
    886042 ±  3%      -1.5%     873038 ±  5%  stress-ng.sockfd.ops_per_sec

also captured raw data as below FYI.

although there are random unstable data, generally speaking, there is no obvious performance difference between these 2 new commits now.

Yes, and this kind of strang performance change case is pretty normal in 0day's test, and they are mostly caused by alignment change in text, data, bss, percpu etc. sections.

We have discussed this in LPC 2021 with doc:
https://lpc.events/event/11/contributions/895/attachments/770/1603/Strange_kernel_performance_changes_lpc_2021.pdf

And we'll post patches to migigate it.

Thanks,
Feng

#5 lore raw
In reply to Oliver Sang

sorry, missed the Feng's patch, attached.

Quoted 136 lines · Oliver Sang

hi, all,

Quoted 10 lines · Wu
Quoted 1 line

Push pending hrtimers away from outgoing CPU earlier,测试过程中,如果没有

hotplug,是不是不应该有性能变化

查看了一下代码,确实应该只有在cpu hotplug的时候,才会运行patch中修改的代码。

不过,在patch中新增加了对cpu状态CPUHP_AP_HRTIMERS_DYING的一个handle,

是否这个improving performance的原因。

另外,和Oliver对过了,这个improving的data应该是多次测试后的结果。

Wu, you are right!
for original report, both 53f408cad0 and parent tested 6 times. (in fact, for all performance report from 0day, 6 is mininum run times for a commit)

the data for 53f408cad0:
"stress-ng.sockfd.ops_per_sec": [

    806893.21,   <--- one unstable data, but still distinct enough comparing to c94c44685d
    890668.75,
    890737.88,
    890370.42,
    888873.71,
    892069.45

],

the data for parent (c94c44685d):
"stress-ng.sockfd.ops_per_sec": [

    772950.12,
    774262.88,
    748388.34,
    774652.04,
    776115.25,
    777131.75

],

based on your feedback, we checked code alignment further. by attached patch from Feng Tang (Cced, our expert about code alignment issues, and is working on patch-set for mitigating this kind of issues, Thanks a lot, Feng!)

and we run tests up to 20 times for both commits, the performance difference is just in noise now. so the original report is less meaningful. sorry for any confusion caused.

below some details.

original 53f408cad0 and its parent looks like below in branch:

* 53f408cad05b hrtimers: Push pending hrtimers away from outgoing CPU earlier
* c94c44685d80 scsi: sd: Fix sshdr use in sd_suspend_common()
* dd3438abfb85 vdpa/mlx5: preserve CVQ vringh index

we inserted the code alignment patch from Feng before c94c44685d80, then the commits in branch became below:

* f8057ff406bab9 hrtimers: Push pending hrtimers away from outgoing CPU earlier
* 620c3bf8aa2f2e scsi: sd: Fix sshdr use in sd_suspend_common()
* 4fe88ea078d804 align kernel/exit.c <----- attached patch from Feng
* dd3438abfb85f6 vdpa/mlx5: preserve CVQ vringh index

then we run same test upon new f8057ff406bab9 and 620c3bf8aa2f2e up to 20 times

=========================================================================================
compiler/cpufreq_governor/kconfig/nr_threads/rootfs/tbox_group/test/testcase/testtime:
gcc-12/performance/x86_64-oc_stream_base_config/100%/debian-12-x86_64-20240206.cgz/lkp-emr-2sp1/sockfd/stress-ng/60s

commit:
620c3bf8aa2f2e ("scsi: sd: Fix sshdr use in sd_suspend_common()") f8057ff406bab9 ("hrtimers: Push pending hrtimers away from outgoing CPU earlier")

620c3bf8aa2f2e37 f8057ff406bab9ca3e6c19548fc
---------------- ---------------------------
fail:runs %reproduction fail:runs
| | |
20:20 0% 20:20 stress-ng.sockfd.pass
%stddev %change %stddev
\ | \

  53177039 ±  3%      -1.5%   52396229 ±  5%  stress-ng.sockfd.ops
    886042 ±  3%      -1.5%     873038 ±  5%  stress-ng.sockfd.ops_per_sec

also captured raw data as below FYI.

although there are random unstable data, generally speaking, there is no obvious performance difference between these 2 new commits now.

for f8057ff406bab9 (saw several not stable data):
"stress-ng.sockfd.ops_per_sec": [

    788846.43,   <---
    870181.86,
    800294.02,   <---
    897801.49,
    896612.93,
    894245.37,
    896740.75,
    894682.9,
    814902.28,   <---
    896683.88,
    896215.86,
    895695.55,
    895589.53,
    897497.99,
    895326.19,
    896870.11,
    897734.02,
    739848.46,   <---
    899569.27,
    895426.67

],

for 620c3bf8aa2f2e (there are also unstable data):
"stress-ng.sockfd.ops_per_sec": [

    896915.05,
    895960.77,
    896191.9,
    897573.54,
    897191.51,
    898619.02,
    902343.05,
    897126.19,
    887130.05,
    884084.2,
    804080.41,   <---
    896124.17,
    894256.43,
    898721.35,
    894504.22,
    897396.18,
    896682.74,
    894763.47,
    898041.33,
    793150.46    <---
Quoted 184 lines

],

Quoted 181 lines

Best Regards

Zheng Wu

From: aurelianliu(刘诗) <[email protected]>
Sent: Tuesday, August 20, 2024 4:24 PM
To: Sang, Oliver <[email protected]>; jasperwang(王佳) <[email protected]>; kaixuxia(夏开旭) <[email protected]>; Liu, Frank <[email protected]>; kasong(宋恺睿) <[email protected]>; Chen, Saga <[email protected]>; kernelxing(邢万里) <[email protected]>; deshengwu (吴德胜) <[email protected]>; flyingpeng(彭浩) <[email protected]>; Zeng, Jason <[email protected]>; Zheng, Wu <[email protected]>; Jia, Yingbao <[email protected]>; Jia, Pei P <[email protected]>
Cc: oe-lkp <[email protected]>; lkp <[email protected]>; Sang, Oliver <[email protected]>
Subject: 回复:[Internet][opencloudos:next] [hrtimers] 53f408cad0:
stress-ng.sockfd.ops_per_sec 13.8% improvement

这里有一个疑问:

Push pending hrtimers away from outgoing CPU earlier,测试过程中,如果没有 hotplug,是不是不应该有性能变化

Sang, Oliver<[email protected]> 在 2024年8月20日周二 16:09 写道:

Hello,

kernel test robot noticed a 13.8% improvement of stress-ng.sockfd.ops_per_sec on:

commit: 53f408cad05bb987af860af22f4151e5a18e6ee8 ("hrtimers: Push pending hrtimers away from outgoing CPU earlier")
https://gitee.com/OpenCloudOS/OpenCloudOS-Kernel.git next

testcase: stress-ng
test machine: 256 threads 4 sockets INTEL(R) XEON(R) PLATINUM 8592+ (Emerald Rapids) with 256G memory
parameters:

nr_threads: 100%
testtime: 60s
test: sockfd
cpufreq_governor: performance

Details are as below:
-------------------------------------------------------------------------------------------------->

The kernel config and materials to reproduce are available at:
https://download.01.org/0day-ci/archive/20240820/
[email protected]

===============================================================================
==========
compiler/cpufreq_governor/kconfig/nr_threads/rootfs/tbox_group/test/testcase/ testtime:
gcc-12/performance/x86_64-oc_stream_base_config/100%/
debian-12-x86_64-20240206.cgz/lkp-emr-2sp1/sockfd/stress-ng/60s

commit:
c94c44685d ("scsi: sd: Fix sshdr use in sd_suspend_common()") 53f408cad0 ("hrtimers: Push pending hrtimers away from outgoing CPU earlier")

c94c44685d801334 53f408cad05bb987af860af22f4
---------------- ---------------------------

         %stddev     %change         %stddev
             \          |                \ 
     52019          +192.9%     152364 ±145%  vmstat.system.cs
    248.33 ±  7%     -19.9%     198.83 ± 16%  perf-c2c.DRAM.local
     11510 ±  2%     +20.0%      13813 ± 13%  perf-c2c.HITM.local
     25227           +17.0%      29523 ± 12%  perf-c2c.HITM.total
  46241536           +13.8%   52608779 ±  3%  stress-ng.sockfd.ops
    770583           +13.8%     876602 ±  3%  stress-ng.sockfd.ops_per_sec
    709901 ±  2%    +473.7%    4072397 ±177% 
stress-ng.time.voluntary_context_switches
   2221056            +4.0%    2309588        proc-vmstat.numa_hit
   1824201            +4.8%    1912626        proc-vmstat.numa_local
   3416606           +10.0%    3757450        proc-vmstat.pgalloc_normal
   2811184           +12.0%    3147390        proc-vmstat.pgfree
 1.646e+10            +3.2%  1.699e+10        perf-stat.i.branch-instructions
  41247621 ±  2%      +7.5%   44359189 ±  2%  perf-stat.i.cache-misses
  89628939           +11.4%   99819592 ±  2%  perf-stat.i.cache-references
     54186          +182.9%     153293 ±141%  perf-stat.i.context-switches
     10.31            -3.2%       9.98        perf-stat.i.cpi
      3124           +19.5%       3733 ± 12%  perf-stat.i.cpu-migrations
     18733            -7.2%      17380 ±  2% 
perf-stat.i.cycles-between-cache-misses
 7.027e+10            +3.9%  7.304e+10        perf-stat.i.instructions
      0.12            +3.0%       0.12        perf-stat.i.ipc
     10.43            -2.9%      10.13        perf-stat.overall.cpi
     17676 ±  2%      -5.7%      16664 ±  2% 
perf-stat.overall.cycles-between-cache-misses
      0.10            +3.0%       0.10        perf-stat.overall.ipc
 1.606e+10            +2.4%  1.645e+10        perf-stat.ps.branch-instructions
 4.528e+11 ±223%    +422.8%  2.367e+12 ± 82%  perf-stat.ps.branch-misses
  40486476 ±  2%      +6.2%   42992791 ±  2%  perf-stat.ps.cache-misses
  87229061           +10.7%   96531559 ±  2%  perf-stat.ps.cache-references
     52859          +194.7%     155786 ±145%  perf-stat.ps.context-switches
      3038           +16.6%       3543 ±  8%  perf-stat.ps.cpu-migrations
  6.86e+10            +3.1%   7.07e+10        perf-stat.ps.instructions
 4.235e+12            +2.5%   4.34e+12        perf-stat.total.instructions
      0.16 ±  3%      -0.1        0.09 ±  8% 
perf-profile.children.cycles-pp.free_uid
      0.22            -0.1        0.15 ±  9% 
perf-profile.children.cycles-pp.__scm_destroy
      0.15            -0.1        0.09 ±  8% 
perf-profile.children.cycles-pp.refcount_dec_not_one
      0.14 ±  3%      -0.0        0.10 ±  9% 
perf-profile.children.cycles-pp.scm_detach_fds
      0.16 ±  3%      -0.0        0.12 ±  9% 
perf-profile.children.cycles-pp.__scm_recv_common
      0.08            -0.0        0.05 ± 44% 
perf-profile.children.cycles-pp.scm_fp_dup
      0.14 ±  2%      -0.0        0.13 ±  2% 
perf-profile.children.cycles-pp.__scm_send
      0.11 ±  3%      +3.6        3.74 ±215% 
perf-profile.children.cycles-pp.do_dentry_open
      0.11 ±  3%      +3.6        3.74 ±215% 
perf-profile.children.cycles-pp.vfs_open
      0.06            +3.7        3.72 ±219% 
perf-profile.children.cycles-pp.____fput
      0.06            +3.7        3.72 ±219% 
perf-profile.children.cycles-pp.__fput
      0.08            +3.7        3.75 ±217% 
perf-profile.children.cycles-pp.syscall
      0.08            +3.7        3.75 ±217% 
perf-profile.children.cycles-pp.task_work_run
      0.18 ±  2%      +7.2        7.41 ±217% 
perf-profile.children.cycles-pp.do_open
      0.00            +7.3        7.28 ±222% 
perf-profile.children.cycles-pp.lockref_put_or_lock
      0.00            +7.3        7.29 ±221% 
perf-profile.children.cycles-pp.dput
      0.31           +10.8       11.13 ±216% 
perf-profile.children.cycles-pp.do_filp_open
      0.30           +10.8       11.13 ±216% 
perf-profile.children.cycles-pp.path_openat
      0.35           +10.8       11.18 ±216% 
perf-profile.children.cycles-pp.do_sys_openat2
      0.36           +10.8       11.19 ±215% 
perf-profile.children.cycles-pp.__x64_sys_openat
      0.39           +10.8       11.22 ±215% 
perf-profile.children.cycles-pp.open64
      0.15            -0.1        0.08 ±  8% 
perf-profile.self.cycles-pp.refcount_dec_not_one
      0.07            -0.0        0.05       
perf-profile.self.cycles-pp.__scm_send
     96.72            +0.1       96.81       

perf-profile.self.cycles-pp.native_queued_spin_lock_slowpath

Disclaimer:
Results have been estimated based on internal Intel analysis and are provided for informational purposes only. Any difference in system hardware or software design or configuration may affect actual performance.

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

SECURITY NOTE: file ~/.netrc must not be accessible by others

commit afc83980ee5b64b79f50225cb395843ecceed88b

Author: Feng Tang <[email protected]>
Date:   Wed Aug 28 20:36:19 2024 +0800

align kernel/exit.c

kernel/exit.c +13 -0
index edb50b4c9972..8164f9f5b3e1 100644
@@ -1925,3 +1925,16 @@ __weak __function_aligned void abort(void)
 	panic("Oops failed to kill thread");
 }
 EXPORT_SYMBOL(abort);
+
+struct pcpu_isolation {
+	unsigned long data;
+} ____cacheline_aligned_in_smp;
+
+#define DEFINE_ALIGN_ISOLATIONS(name) \
+	void name ## _text_align(void); \
+	void __attribute__((aligned(4096))) name ## _text_align(void) {} \
+	long name ## _data_align __attribute__((aligned(4096))) = 1; \
+	long name ## _bss_align __attribute__((aligned(4096))); \
+	DEFINE_PER_CPU(struct pcpu_isolation, name ## _pcp_align);
+
+DEFINE_ALIGN_ISOLATIONS(kexit);