public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] lib/Makefile: Make union-find compilation conditional on CONFIG_CPUSETS
@ 2024-10-09 15:40 Kuan-Wei Chiu
  2024-10-09 16:43 ` Waiman Long
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Kuan-Wei Chiu @ 2024-10-09 15:40 UTC (permalink / raw)
  To: akpm, hch, llong, xavier_qy
  Cc: lizefan.x, tj, hannes, mkoutny, jserv, linux-kernel, cgroups,
	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.

Link: https://lore.kernel.org/lkml/1ccd6411-5002-4574-bb8e-3e64bba6a757@redhat.com/
Suggested-by: Waiman Long <llong@redhat.com>
Signed-off-by: Kuan-Wei Chiu <visitorckw@gmail.com>
---
 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
 
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] lib/Makefile: Make union-find compilation conditional on CONFIG_CPUSETS
  2024-10-09 15:40 [PATCH] lib/Makefile: Make union-find compilation conditional on CONFIG_CPUSETS Kuan-Wei Chiu
@ 2024-10-09 16:43 ` Waiman Long
  2024-10-09 16:44 ` Tejun Heo
  2024-10-10  9:38 ` Christoph Hellwig
  2 siblings, 0 replies; 6+ messages in thread
From: Waiman Long @ 2024-10-09 16:43 UTC (permalink / raw)
  To: Kuan-Wei Chiu, akpm, hch, llong, xavier_qy
  Cc: lizefan.x, tj, hannes, mkoutny, jserv, linux-kernel, cgroups

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@redhat.com/
> Suggested-by: Waiman Long <llong@redhat.com>
> Signed-off-by: Kuan-Wei Chiu <visitorckw@gmail.com>
> ---
>   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@redhat.com>


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] lib/Makefile: Make union-find compilation conditional on CONFIG_CPUSETS
  2024-10-09 15:40 [PATCH] lib/Makefile: Make union-find compilation conditional on CONFIG_CPUSETS Kuan-Wei Chiu
  2024-10-09 16:43 ` Waiman Long
@ 2024-10-09 16:44 ` Tejun Heo
  2024-10-10  9:38 ` Christoph Hellwig
  2 siblings, 0 replies; 6+ messages in thread
From: Tejun Heo @ 2024-10-09 16:44 UTC (permalink / raw)
  To: Kuan-Wei Chiu
  Cc: akpm, hch, llong, xavier_qy, lizefan.x, hannes, mkoutny, jserv,
	linux-kernel, cgroups

On Wed, Oct 09, 2024 at 11:40:22PM +0800, 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@redhat.com/
> Suggested-by: Waiman Long <llong@redhat.com>
> Signed-off-by: Kuan-Wei Chiu <visitorckw@gmail.com>

Acked-by: Tejun Heo <tj@kernel.org>

Andrew, can you please pick up this one?

Thanks.

-- 
tejun

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] lib/Makefile: Make union-find compilation conditional on CONFIG_CPUSETS
  2024-10-09 15:40 [PATCH] lib/Makefile: Make union-find compilation conditional on CONFIG_CPUSETS Kuan-Wei Chiu
  2024-10-09 16:43 ` Waiman Long
  2024-10-09 16:44 ` Tejun Heo
@ 2024-10-10  9:38 ` Christoph Hellwig
  2024-10-11 14:12   ` [PATCH v2] " Kuan-Wei Chiu
  2 siblings, 1 reply; 6+ messages in thread
From: Christoph Hellwig @ 2024-10-10  9:38 UTC (permalink / raw)
  To: Kuan-Wei Chiu
  Cc: akpm, hch, llong, xavier_qy, lizefan.x, tj, hannes, mkoutny,
	jserv, linux-kernel, cgroups

On Wed, Oct 09, 2024 at 11:40:22PM +0800, Kuan-Wei Chiu wrote:
>  	 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/

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH v2] lib/Makefile: Make union-find compilation conditional on CONFIG_CPUSETS
  2024-10-10  9:38 ` Christoph Hellwig
@ 2024-10-11 14:12   ` Kuan-Wei Chiu
  2024-10-14  5:55     ` Christoph Hellwig
  0 siblings, 1 reply; 6+ messages in thread
From: Kuan-Wei Chiu @ 2024-10-11 14:12 UTC (permalink / raw)
  To: akpm, hch
  Cc: llong, xavier_qy, lizefan.x, tj, hannes, mkoutny, jserv,
	linux-kernel, cgroups, Kuan-Wei Chiu, Waiman Long

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@redhat.com/
Suggested-by: Waiman Long <llong@redhat.com>
Signed-off-by: Kuan-Wei Chiu <visitorckw@gmail.com>
Acked-by: Waiman Long <longman@redhat.com>
Acked-by: Tejun Heo <tj@kernel.org>
---
 init/Kconfig | 1 +
 lib/Kconfig  | 3 +++
 lib/Makefile | 3 ++-
 3 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/init/Kconfig b/init/Kconfig
index 530a382ee0fe..323206ff5848 100644
--- a/init/Kconfig
+++ b/init/Kconfig
@@ -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
diff --git a/lib/Kconfig b/lib/Kconfig
index b38849af6f13..cf303bd91dda 100644
--- a/lib/Kconfig
+++ b/lib/Kconfig
@@ -777,3 +777,6 @@ config POLYNOMIAL
 
 config FIRMWARE_TABLE
 	bool
+
+config UNION_FIND
+	bool
diff --git a/lib/Makefile b/lib/Makefile
index 773adf88af41..03b88b501b49 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_UNION_FIND) += union_find.o
 lib-$(CONFIG_PRINTK) += dump_stack.o
 lib-$(CONFIG_SMP) += cpumask.o
 
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH v2] lib/Makefile: Make union-find compilation conditional on CONFIG_CPUSETS
  2024-10-11 14:12   ` [PATCH v2] " Kuan-Wei Chiu
@ 2024-10-14  5:55     ` Christoph Hellwig
  0 siblings, 0 replies; 6+ messages in thread
From: Christoph Hellwig @ 2024-10-14  5:55 UTC (permalink / raw)
  To: Kuan-Wei Chiu
  Cc: akpm, hch, llong, xavier_qy, lizefan.x, tj, hannes, mkoutny,
	jserv, linux-kernel, cgroups, Waiman Long

On Fri, Oct 11, 2024 at 10:12:14PM +0800, 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.

Looks good:

Reviewed-by: Christoph Hellwig <hch@lst.de>


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2024-10-14  5:55 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-09 15:40 [PATCH] lib/Makefile: Make union-find compilation conditional on CONFIG_CPUSETS Kuan-Wei Chiu
2024-10-09 16:43 ` Waiman Long
2024-10-09 16:44 ` Tejun Heo
2024-10-10  9:38 ` Christoph Hellwig
2024-10-11 14:12   ` [PATCH v2] " Kuan-Wei Chiu
2024-10-14  5:55     ` Christoph Hellwig

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox