Skip to contentSkip to conversation

lib/Makefile: Make union-find compilation conditional on CONFIG_CPUSETS

PATCH Superseded Kuan-Wei Chiu 4 participants 6 messages Oct 9, 2024 – Oct 14, 2024

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 lib/Makefile: Make union-find compilation conditional on CONFIG_CPUSETS

Currently, cpuset is the only user of the union-find implementation. Compiling union-find in all configurations unnecessarily increases the code size when building the kernel without cgroup support. Modify the build system to compile union-find only when CONFIG_CPUSETS is enabled.

---
 lib/Makefile | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
lib/Makefile +2 -1
index 773adf88af41..53f82de7cbe2 100644
@@ -35,8 +35,9 @@ lib-y := ctype.o string.o vsprintf.o cmdline.o \
 	 is_single_threaded.o plist.o decompress.o kobject_uevent.o \
 	 earlycpio.o seq_buf.o siphash.o dec_and_lock.o \
 	 nmi_backtrace.o win_minmax.o memcat_p.o \
-	 buildid.o objpool.o union_find.o
+	 buildid.o objpool.o
 
+lib-$(CONFIG_CPUSETS) += union_find.o
 lib-$(CONFIG_PRINTK) += dump_stack.o
 lib-$(CONFIG_SMP) += cpumask.o
 
Signature · 1 line
2.34.1
Acked-by on v1 1/1
#1 lore raw
Quoted 17 lines · Kuan-Wei Chiu

Currently, cpuset is the only user of the union-find implementation. Compiling union-find in all configurations unnecessarily increases the code size when building the kernel without cgroup support. Modify the build system to compile union-find only when CONFIG_CPUSETS is enabled.

---
  lib/Makefile | 3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)
lib/Makefile +0 -0
index 773adf88af41..53f82de7cbe2 100644

lib/Makefile lib-y := ctype.o string.o vsprintf.o cmdline.o \ · line 43

Quoted 10 lines
lib/Makefile +2 -1
@@ -35,8 +35,9 @@ lib-y := ctype.o string.o vsprintf.o cmdline.o \
  	 is_single_threaded.o plist.o decompress.o kobject_uevent.o \
  	 earlycpio.o seq_buf.o siphash.o dec_and_lock.o \
  	 nmi_backtrace.o win_minmax.o memcat_p.o \
-	 buildid.o objpool.o union_find.o
+	 buildid.o objpool.o
 
+lib-$(CONFIG_CPUSETS) += union_find.o
  lib-$(CONFIG_PRINTK) += dump_stack.o
  lib-$(CONFIG_SMP) += cpumask.o
 
maintainer Acked-by on v1 1/1
#2 lore raw
In reply to Kuan-Wei Chiu
Quoted 8 lines · Kuan-Wei Chiu

Currently, cpuset is the only user of the union-find implementation. Compiling union-find in all configurations unnecessarily increases the code size when building the kernel without cgroup support. Modify the build system to compile union-find only when CONFIG_CPUSETS is enabled.

Andrew, can you please pick up this one?

Thanks.

Signature · 1 line
tejun
#3 lore raw
In reply to Kuan-Wei Chiu

lib/Makefile lib-y := ctype.o string.o vsprintf.o cmdline.o \ · line 40

Quoted 5 lines · Kuan-Wei Chiu
lib/Makefile +2 -1
 	 nmi_backtrace.o win_minmax.o memcat_p.o \
-	 buildid.o objpool.o union_find.o
+	 buildid.o objpool.o
 
+lib-$(CONFIG_CPUSETS) += union_find.o

The usual way would be to have a new symbol selected by CPUSETS rather than hardcoding the user here in lib/

#4 lore raw

PATCH v2 1/1 lib/Makefile: Make union-find compilation conditional on CONFIG_CPUSETS

Currently, cpuset is the only user of the union-find implementation. Compiling union-find in all configurations unnecessarily increases the code size when building the kernel without cgroup support. Modify the build system to compile union-find only when CONFIG_CPUSETS is enabled.

---
 init/Kconfig | 1 +
 lib/Kconfig  | 3 +++
 lib/Makefile | 3 ++-
 3 files changed, 6 insertions(+), 1 deletion(-)
init/Kconfig +1 -0
index 530a382ee0fe..323206ff5848 100644
@@ -1153,6 +1153,7 @@ config CGROUP_HUGETLB
 config CPUSETS
 	bool "Cpuset controller"
 	depends on SMP
+	select UNION_FIND
 	help
 	  This option will let you create and manage CPUSETs which
 	  allow dynamically partitioning a system into sets of CPUs and
lib/Kconfig +3 -0
index b38849af6f13..cf303bd91dda 100644
@@ -777,3 +777,6 @@ config POLYNOMIAL
 
 config FIRMWARE_TABLE
 	bool
+
+config UNION_FIND
+	bool
lib/Makefile +2 -1
index 773adf88af41..03b88b501b49 100644
@@ -35,8 +35,9 @@ lib-y := ctype.o string.o vsprintf.o cmdline.o \
 	 is_single_threaded.o plist.o decompress.o kobject_uevent.o \
 	 earlycpio.o seq_buf.o siphash.o dec_and_lock.o \
 	 nmi_backtrace.o win_minmax.o memcat_p.o \
-	 buildid.o objpool.o union_find.o
+	 buildid.o objpool.o
 
+lib-$(CONFIG_UNION_FIND) += union_find.o
 lib-$(CONFIG_PRINTK) += dump_stack.o
 lib-$(CONFIG_SMP) += cpumask.o
 
Signature · 1 line
2.34.1
Reviewed-by on v2 1/1
#5 lore raw
Quoted 4 lines · Kuan-Wei Chiu

Currently, cpuset is the only user of the union-find implementation. Compiling union-find in all configurations unnecessarily increases the code size when building the kernel without cgroup support. Modify the build system to compile union-find only when CONFIG_CPUSETS is enabled.

Looks good: