Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ZTS: Make use of CPU pinning and KSM #16641

Closed
wants to merge 2 commits into from
Closed

Conversation

mcmilk
Copy link
Contributor

@mcmilk mcmilk commented Oct 13, 2024

Motivation and Context

Within the Linux VM's the current memory (7GiB) seems sometimes a bit too short for some tests.
The first commit will optimize the Kernel Same-page Merging (KSM) settings, so we can easily increase the RAM to 8GiB.

With CPU pinning, we should get some speedup because of better cpu cache re-use.
The second commit will set the cores 0+1 to VM1 and the cores 2+3 to VM2.

How Has This Been Tested?

Testing was done via ZTS, and the Performance went up a bit:

Image without optimization with optimization
AlmaLinux 8 3h 42m 35s 3h 6m 52s
AlmaLinux 9 3h 30m 50s 3h 32m 43s
Centos Stream 9 3h 30m 5s 3h 24m 52s
Debian11 3h 16m 30s 3h 1m 47s
Debian12 3h 12m 44s 2h 56m 48s
Fedora 39 3h 21m 34s 3h 29m 40s
Fedora 40 3h 18m 11s 3h 20m 32s
Freebsd13-4r 2h 18m 26s 2h 24m 57s
Freebsd14-0r 2h 32m 59s 2h 28m 7s
Freebsd14-1s 2h 28m 18s 2h 21m 29s
Ubuntu20 3h 3m 33s 2h 43m 30s
Ubuntu22 3h 42m 29s 3h 18m 38s
Ubuntu24 3h 32m 4s 3h 33m 0s
Total sum 1d 17h 30m 1d 15h 43m

Maybe some tests, which needed more memory will also be fine now.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Performance enhancement (non-breaking change which improves efficiency)
  • Code cleanup (non-breaking change which makes code smaller or more readable)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Library ABI change (libzfs, libzfs_core, libnvpair, libuutil and libzfsbootenv)
  • Documentation (a change to man pages or other documentation)

Checklist:

Kernel same-page Merging (KSM) allows KVM guests to share identical
memory pages. These shared pages are usually common libraries or other
identical, high-use data.

The current configuration was a bit to lazy - so KSM didn't work very
well. With the new configuration I could run 3 Linux VMs in parralel.

FreeBSD can't benefit from it. But FreeBSD is not so memory hungry in
general, so there is no need for it ;)

Signed-off-by: Tino Reichardt <milky-zfs@mcmilk.de>
With CPU pinning, we should get some speedup because of better
cpu cache re-use.

Signed-off-by: Tino Reichardt <milky-zfs@mcmilk.de>
@mcmilk
Copy link
Contributor Author

mcmilk commented Oct 13, 2024

Full Testsuite run: https://github.com/mcmilk/zfs/actions/runs/11312294812 of this PR

@behlendorf behlendorf added the Status: Accepted Ready to integrate (reviewed, tested) label Oct 14, 2024
behlendorf pushed a commit that referenced this pull request Oct 14, 2024
With CPU pinning, we should get some speedup because of better
cpu cache re-use.

Reviewed-by: George Melikov <mail@gmelikov.ru>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Tino Reichardt <milky-zfs@mcmilk.de>
Closes #16641
behlendorf pushed a commit to behlendorf/zfs that referenced this pull request Oct 14, 2024
Kernel same-page Merging (KSM) allows KVM guests to share identical
memory pages. These shared pages are usually common libraries or other
identical, high-use data.

The current configuration was a bit to lazy - so KSM didn't work very
well. With the new configuration I could run 3 Linux VMs in parralel.

FreeBSD can't benefit from it. But FreeBSD is not so memory hungry in
general, so there is no need for it ;)

Reviewed-by: George Melikov <mail@gmelikov.ru>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Tino Reichardt <milky-zfs@mcmilk.de>
Closes openzfs#16641
behlendorf pushed a commit to behlendorf/zfs that referenced this pull request Oct 14, 2024
With CPU pinning, we should get some speedup because of better
cpu cache re-use.

Reviewed-by: George Melikov <mail@gmelikov.ru>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Tino Reichardt <milky-zfs@mcmilk.de>
Closes openzfs#16641
robn pushed a commit to robn/zfs that referenced this pull request Nov 5, 2024
Kernel same-page Merging (KSM) allows KVM guests to share identical
memory pages. These shared pages are usually common libraries or other
identical, high-use data.

The current configuration was a bit to lazy - so KSM didn't work very
well. With the new configuration I could run 3 Linux VMs in parralel.

FreeBSD can't benefit from it. But FreeBSD is not so memory hungry in
general, so there is no need for it ;)

Reviewed-by: George Melikov <mail@gmelikov.ru>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Tino Reichardt <milky-zfs@mcmilk.de>
Closes openzfs#16641
robn pushed a commit to robn/zfs that referenced this pull request Nov 5, 2024
With CPU pinning, we should get some speedup because of better
cpu cache re-use.

Reviewed-by: George Melikov <mail@gmelikov.ru>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Tino Reichardt <milky-zfs@mcmilk.de>
Closes openzfs#16641
ptr1337 pushed a commit to CachyOS/zfs that referenced this pull request Nov 14, 2024
Kernel same-page Merging (KSM) allows KVM guests to share identical
memory pages. These shared pages are usually common libraries or other
identical, high-use data.

The current configuration was a bit to lazy - so KSM didn't work very
well. With the new configuration I could run 3 Linux VMs in parralel.

FreeBSD can't benefit from it. But FreeBSD is not so memory hungry in
general, so there is no need for it ;)

Reviewed-by: George Melikov <mail@gmelikov.ru>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Tino Reichardt <milky-zfs@mcmilk.de>
Closes openzfs#16641
ptr1337 pushed a commit to CachyOS/zfs that referenced this pull request Nov 14, 2024
With CPU pinning, we should get some speedup because of better
cpu cache re-use.

Reviewed-by: George Melikov <mail@gmelikov.ru>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Tino Reichardt <milky-zfs@mcmilk.de>
Closes openzfs#16641
lundman pushed a commit to openzfsonwindows/openzfs that referenced this pull request Jan 26, 2025
Kernel same-page Merging (KSM) allows KVM guests to share identical
memory pages. These shared pages are usually common libraries or other
identical, high-use data.

The current configuration was a bit to lazy - so KSM didn't work very
well. With the new configuration I could run 3 Linux VMs in parralel.

FreeBSD can't benefit from it. But FreeBSD is not so memory hungry in
general, so there is no need for it ;)

Reviewed-by: George Melikov <mail@gmelikov.ru>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Tino Reichardt <milky-zfs@mcmilk.de>
Closes openzfs#16641
lundman pushed a commit to openzfsonwindows/openzfs that referenced this pull request Jan 26, 2025
With CPU pinning, we should get some speedup because of better
cpu cache re-use.

Reviewed-by: George Melikov <mail@gmelikov.ru>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Tino Reichardt <milky-zfs@mcmilk.de>
Closes openzfs#16641
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Accepted Ready to integrate (reviewed, tested)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants