Skip to content

RFE: make cpuplugd arch-agnostic #24

@sharkcz

Description

@sharkcz

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.

Metadata

Metadata

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions