Re: [PATCH] lib/Makefile: Make union-find compilation conditional on CONFIG_CPUSETS

From: Waiman Long
Date: Wed Oct 09 2024 - 12:46:15 EST


On 10/9/24 11:40 AM, Kuan-Wei Chiu wrote:
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.

Link: https://lore.kernel.org/lkml/1ccd6411-5002-4574-bb8e-3e64bba6a757@xxxxxxxxxx/
Suggested-by: Waiman Long <llong@xxxxxxxxxx>
Signed-off-by: Kuan-Wei Chiu <visitorckw@xxxxxxxxx>
---
lib/Makefile | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lib/Makefile b/lib/Makefile
index 773adf88af41..53f82de7cbe2 100644
--- a/lib/Makefile
+++ b/lib/Makefile
@@ -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
Acked-by: Waiman Long <longman@xxxxxxxxxx>