performance

Differences between revisions 2 and 6 (spanning 4 versions)
Revision 2 as of 2018-09-06 17:13:44
Size: 2069
Editor: manjo
Comment:
Revision 6 as of 2018-09-06 17:24:55
Size: 2315
Editor: manjo
Comment:
Deletions are marked like this. Additions are marked like this.
Line 8: Line 8:
 * IOMMU Passthrough.
Line 9: Line 10:
 * Transparent huge pages
 * IOMMU Passthrough.
  == IOMMU Passthrough ==
Setting iommu.passthrough to 1 on th kernel command line bypasses the IOMMU translation for DMA, setting it to 0 uses IOMMU translation for DMA. This will need to be set at the time of deployment (using preseeds) or by editing the appropriate grub configuration files and reboot the system for the changes to take effect.
Line 12: Line 14:
== IOMMU Passthrough ==
Setting iommu.passthrough to 1 on th kernel command line bypasses the IOMMU translation for DMA, setting it to 0 uses IOMMU translation for DMA.

It has been observed that on Cavium Thunder X2 setting the kernel command line parameter '''iommu.passthrough=1''' Flexible I/O Tester Synthetic Benchmark (Fio) performance with 4k page size was comparable to that of 64k pages.
It has been observed that on Cavium Thunder X2 setting the kernel command line parameter iommu.passthrough=1, Flexible I/O Tester Synthetic Benchmark (Fio) performance (with 4k page size) was comparable to that of 64k pages.
Line 21: Line 20:
 * Specify the number of hugepages  * Specify the number of hugepages (''here I am using 512 as an example, you might need to change that depending on your use case.'')

4k page size vs 64k page size

Ubuntu currently supports 4k page size for all architectures except for ppc64el. While 64k page sizes are beneficial to certain memory bound benchmarks, but there is a penalty, it might be wasteful if you are dealing with small data structures that have to be page aligned. Also, 64k page size could break compatibility with old ARMv7 binaries. 64k page size will need to reconsidered with the introduction of 52bit VA.

Improve performance benchmarks with 4k pages

There are ways to get comparable performance using 4k page size and avoid the penalties of 64k pages.

  • IOMMU Passthrough.
  • Hugetlbfs

IOMMU Passthrough

Setting iommu.passthrough to 1 on th kernel command line bypasses the IOMMU translation for DMA, setting it to 0 uses IOMMU translation for DMA. This will need to be set at the time of deployment (using preseeds) or by editing the appropriate grub configuration files and reboot the system for the changes to take effect.

It has been observed that on Cavium Thunder X2 setting the kernel command line parameter iommu.passthrough=1, Flexible I/O Tester Synthetic Benchmark (Fio) performance (with 4k page size) was comparable to that of 64k pages.

Hugetlbfs

This is a runtime feature that can be enabled from userspace, and is currently supported by applications like Java, Qemu and benchmarks like Flexible I/O Tester Synthetic Benchmark (Fio).

Enable hugetlbfs

  • Specify the number of hugepages (here I am using 512 as an example, you might need to change that depending on your use case.)

 sudo sysctl -w vm.nr_hugepages=512 

  • Mount the hugetlbfs

 sudo mkdir /hugetlbfs
 sudo mount -t hugetlbfs none /hugetlbfs 

Using hugetlbfs with Fio benchmark

With Fio benchmark you can enable mmaphuge for iomem and mem options.

 sudo touch hugepages/file
 sudo  fio -rw=read -blocksize=128k -iodepth=128 -buffered=0 -direct=1 -ioengine=libaio -runtime=180 -filename=/dev/nvme0n1 -name=test -time_based -group_reporting -numjobs=4 -iomem=mmaphuge -mem=mmaphuge:/home/ubuntu/hugepages/file -output=output.txt

ARM64/performance (last edited 2022-07-31 21:16:38 by xypron)