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

RFE: make cpuplugd arch-agnostic #24

Open
sharkcz opened this issue Jan 3, 2018 · 3 comments
Open

RFE: make cpuplugd arch-agnostic #24

sharkcz opened this issue Jan 3, 2018 · 3 comments

Comments

@sharkcz
Copy link
Contributor

sharkcz commented Jan 3, 2018

I think the idea behind cpuplugd is useful in general, dynamically add resources when needed and remove them when not needed. And it shouldn't be difficult to use cpuplugd on platform other than s390x, with

diff --git a/cpuplugd/cpu.c b/cpuplugd/cpu.c
index a4456cf..e603137 100644
--- a/cpuplugd/cpu.c
+++ b/cpuplugd/cpu.c
@@ -24,7 +24,7 @@ int get_numcpus()
 
        for (i = 0; ; i++) {
                /* check whether file exists and is readable */
-               sprintf(path, "/sys/devices/system/cpu/cpu%d/online", i);
+               sprintf(path, "/sys/devices/system/cpu/cpu%d", i);
                if (access(path, R_OK) == 0)
                        number++;
                else

it worked on my x86 machine (for the CPU part). Although more changes will be needed for a proper non-s390x support. I believe it would save power when used with modern multi-core CPUs like Power9 or some AArch64 ones.

Then cpuplugd might be another candidate for moving into util-linux package.

@michael-holzheu
Copy link
Member

@gerald-schaefer could you have a look please?

@gerald-schaefer
Copy link
Contributor

I am a little surprised that Intel doesn't seem to have an online attribute for CPU 0, and the concept of "(de)configured" CPUs also seems to be missing, but it shouldn't be too difficult to adjust the cpuplugd code for this (at least get_numcpus(), get_num_online_cpus() and cpu_is_configured(), from a quick glance). The memory hotplug part using the s390-specific cmm memory balloon would also need to be disabled for other archs, or maybe rewritten to use the generic sysfs memory hotplug interface.

I currently don't have resources for this, and I also wonder if there really would be demand for this on other architectures, so that it would be worth the effort. If you want to spend the effort, feel free to send a pull request with the complete changes, or maybe even move it to util-linux.

@sharkcz
Copy link
Contributor Author

sharkcz commented Jan 10, 2018

I'm planning to play with it more seriously when I get my Power9-based based workstation to save some power/electricity :-) Will let you know about the results.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants