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

Implement memory and CPU hotplug #11212

Merged
merged 12 commits into from
Dec 10, 2020
Merged

Implement memory and CPU hotplug #11212

merged 12 commits into from
Dec 10, 2020

Conversation

pcd1193182
Copy link
Contributor

@pcd1193182 pcd1193182 commented Nov 16, 2020

Signed-off-by: Paul Dagnelie pcd@delphix.com

Motivation and Context

In virtualized environments, it is common to want to adjust the resource allocation of a VM without rebooting it. Modern systems support both addition and removal of memory and CPUs, but ZFS does not. This patch adds support for hotplugging CPUs and memory to ZFS.

Description

ZFS currently doesn't react to hotplugging cpu or memory into the system in any way. This patch changes that by adding logic to the ARC that allows the system to take advantage of new memory that is added for caching purposes. It also adds logic to the taskq infrastructure to support dynamically expanding the number of threads allocated to a taskq.

How Has This Been Tested?

The zfs test suite and zloop have been run against this patch, both before and after hotplugging cpu and memory.

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)
  • Documentation (a change to man pages or other documentation)

Checklist:

include/os/linux/spl/sys/taskq.h Outdated Show resolved Hide resolved
module/zfs/dmu_objset.c Outdated Show resolved Hide resolved
Copy link

@ghost ghost left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The FreeBSD part looks fine, we don't have CPU hotplugging.

@behlendorf behlendorf added the Status: Code Review Needed Ready for review and testing label Nov 17, 2020
module/os/linux/spl/spl-taskq.c Show resolved Hide resolved
module/os/linux/zfs/arc_os.c Outdated Show resolved Hide resolved
module/zfs/arc.c Show resolved Hide resolved
module/os/linux/zfs/arc_os.c Show resolved Hide resolved
module/os/linux/spl/spl-taskq.c Outdated Show resolved Hide resolved
module/os/linux/spl/spl-taskq.c Outdated Show resolved Hide resolved
module/os/linux/spl/spl-taskq.c Outdated Show resolved Hide resolved
module/os/linux/spl/spl-taskq.c Outdated Show resolved Hide resolved
module/os/linux/zfs/arc_os.c Outdated Show resolved Hide resolved
module/os/linux/spl/spl-taskq.c Show resolved Hide resolved
module/os/linux/spl/spl-taskq.c Outdated Show resolved Hide resolved
module/os/linux/spl/spl-taskq.c Outdated Show resolved Hide resolved
include/os/linux/spl/sys/taskq.h Outdated Show resolved Hide resolved
module/os/linux/spl/spl-taskq.c Outdated Show resolved Hide resolved
module/os/linux/spl/spl-taskq.c Show resolved Hide resolved
module/os/linux/spl/spl-taskq.c Show resolved Hide resolved
module/os/linux/zfs/arc_os.c Outdated Show resolved Hide resolved
module/os/linux/zfs/arc_os.c Show resolved Hide resolved
module/os/linux/spl/spl-taskq.c Outdated Show resolved Hide resolved
module/os/linux/spl/spl-taskq.c Outdated Show resolved Hide resolved
@behlendorf
Copy link
Contributor

If you rebase this on master we should be able to get a clean run on the FreeBSD head builder.

pcd1193182 and others added 8 commits December 3, 2020 11:22
Signed-off-by: Paul Dagnelie <pcd@delphix.com>
Co-authored-by: Matthew Ahrens <matthew.ahrens@delphix.com>
Co-authored-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Paul Dagnelie <pcd@delphix.com>
Signed-off-by: Paul Dagnelie <pcd@delphix.com>
Signed-off-by: Paul Dagnelie <pcd@delphix.com>
Signed-off-by: Paul Dagnelie <pcd@delphix.com>
Signed-off-by: Paul Dagnelie <pcd@delphix.com>
Signed-off-by: Paul Dagnelie <pcd@delphix.com>
module/os/linux/spl/spl-taskq.c Outdated Show resolved Hide resolved
module/os/linux/spl/spl-taskq.c Outdated Show resolved Hide resolved
module/os/linux/spl/spl-taskq.c Outdated Show resolved Hide resolved
module/os/linux/spl/spl-taskq.c Show resolved Hide resolved
module/os/linux/spl/spl-taskq.c Outdated Show resolved Hide resolved
module/os/linux/spl/spl-taskq.c Show resolved Hide resolved
Signed-off-by: Paul Dagnelie <pcd@delphix.com>
Signed-off-by: Paul Dagnelie <pcd@delphix.com>
Signed-off-by: Paul Dagnelie <pcd@delphix.com>
@behlendorf behlendorf added Status: Accepted Ready to integrate (reviewed, tested) and removed Status: Code Review Needed Ready for review and testing labels Dec 10, 2020
@behlendorf behlendorf merged commit 60a4c7d into openzfs:master Dec 10, 2020
pcd1193182 added a commit to pcd1193182/zfs that referenced this pull request Dec 10, 2020
ZFS currently doesn't react to hotplugging cpu or memory into the
system in any way. This patch changes that by adding logic to the ARC
that allows the system to take advantage of new memory that is added
for caching purposes. It also adds logic to the taskq infrastructure
to support dynamically expanding the number of threads allocated to a
taskq.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Co-authored-by: Matthew Ahrens <matthew.ahrens@delphix.com>
Co-authored-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Paul Dagnelie <pcd@delphix.com>
Closes openzfs#11212
jsai20 pushed a commit to jsai20/zfs that referenced this pull request Mar 30, 2021
ZFS currently doesn't react to hotplugging cpu or memory into the 
system in any way. This patch changes that by adding logic to the ARC 
that allows the system to take advantage of new memory that is added 
for caching purposes. It also adds logic to the taskq infrastructure 
to support dynamically expanding the number of threads allocated to a 
taskq.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Co-authored-by: Matthew Ahrens <matthew.ahrens@delphix.com>
Co-authored-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Paul Dagnelie <pcd@delphix.com>
Closes openzfs#11212
sempervictus pushed a commit to sempervictus/zfs that referenced this pull request May 31, 2021
ZFS currently doesn't react to hotplugging cpu or memory into the 
system in any way. This patch changes that by adding logic to the ARC 
that allows the system to take advantage of new memory that is added 
for caching purposes. It also adds logic to the taskq infrastructure 
to support dynamically expanding the number of threads allocated to a 
taskq.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Co-authored-by: Matthew Ahrens <matthew.ahrens@delphix.com>
Co-authored-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Paul Dagnelie <pcd@delphix.com>
Closes openzfs#11212
@aaronjwood
Copy link

Please correct me if I'm wrong but it sounds like this patch covers the case I had asked about here, but in a better way (supporting dynamic memory via ballooning) #10200

If so that's awesome, and I'll close out that issue! :)

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.

5 participants