* [PATCH] mm/cma: Remove CONFIG_CMA_SYSFS option
@ 2025-11-13 13:56 Jean Delvare
2025-11-13 15:35 ` David Hildenbrand (Red Hat)
` (2 more replies)
0 siblings, 3 replies; 7+ messages in thread
From: Jean Delvare @ 2025-11-13 13:56 UTC (permalink / raw)
To: linux-mm; +Cc: LKML, David Hildenbrand
The sysfs interface to CMA has a marginal runtime cost and a small
footprint, there's no reason not to include it in all kernels where
the dependencies are satisfied.
Signed-off-by: Jean Delvare <jdelvare@suse.de>
---
As discussed with David:
https://lkml.org/lkml/2025/8/6/371
arch/loongarch/configs/loongson3_defconfig | 1 -
arch/s390/configs/debug_defconfig | 1 -
arch/s390/configs/defconfig | 1 -
mm/Kconfig | 7 -------
mm/Makefile | 4 +++-
mm/cma.h | 4 ++--
6 files changed, 5 insertions(+), 13 deletions(-)
--- linux-6.17.orig/arch/loongarch/configs/loongson3_defconfig
+++ linux-6.17/arch/loongarch/configs/loongson3_defconfig
@@ -120,7 +120,6 @@ CONFIG_MEMORY_HOTREMOVE=y
CONFIG_KSM=y
CONFIG_TRANSPARENT_HUGEPAGE=y
CONFIG_CMA=y
-CONFIG_CMA_SYSFS=y
CONFIG_USERFAULTFD=y
CONFIG_NET=y
CONFIG_PACKET=y
--- linux-6.17.orig/arch/s390/configs/debug_defconfig
+++ linux-6.17/arch/s390/configs/debug_defconfig
@@ -103,7 +103,6 @@ CONFIG_MEMORY_HOTREMOVE=y
CONFIG_KSM=y
CONFIG_TRANSPARENT_HUGEPAGE=y
CONFIG_CMA_DEBUGFS=y
-CONFIG_CMA_SYSFS=y
CONFIG_CMA_AREAS=7
CONFIG_MEM_SOFT_DIRTY=y
CONFIG_DEFERRED_STRUCT_PAGE_INIT=y
--- linux-6.17.orig/arch/s390/configs/defconfig
+++ linux-6.17/arch/s390/configs/defconfig
@@ -95,7 +95,6 @@ CONFIG_MEMORY_HOTPLUG=y
CONFIG_MEMORY_HOTREMOVE=y
CONFIG_KSM=y
CONFIG_TRANSPARENT_HUGEPAGE=y
-CONFIG_CMA_SYSFS=y
CONFIG_CMA_AREAS=7
CONFIG_MEM_SOFT_DIRTY=y
CONFIG_DEFERRED_STRUCT_PAGE_INIT=y
--- linux-6.17.orig/mm/Makefile
+++ linux-6.17/mm/Makefile
@@ -119,6 +119,9 @@ obj-$(CONFIG_ZPOOL) += zpool.o
obj-$(CONFIG_ZSMALLOC) += zsmalloc.o
obj-$(CONFIG_GENERIC_EARLY_IOREMAP) += early_ioremap.o
obj-$(CONFIG_CMA) += cma.o
+ifdef CONFIG_SYSFS
+obj-$(CONFIG_CMA) += cma_sysfs.o
+endif
obj-$(CONFIG_NUMA) += numa.o
obj-$(CONFIG_NUMA_MEMBLKS) += numa_memblks.o
obj-$(CONFIG_NUMA_EMU) += numa_emulation.o
@@ -127,7 +130,6 @@ obj-$(CONFIG_PAGE_EXTENSION) += page_ext
obj-$(CONFIG_PAGE_TABLE_CHECK) += page_table_check.o
obj-$(CONFIG_CMA_DEBUGFS) += cma_debug.o
obj-$(CONFIG_SECRETMEM) += secretmem.o
-obj-$(CONFIG_CMA_SYSFS) += cma_sysfs.o
obj-$(CONFIG_USERFAULTFD) += userfaultfd.o
obj-$(CONFIG_IDLE_PAGE_TRACKING) += page_idle.o
obj-$(CONFIG_DEBUG_PAGEALLOC) += debug_page_alloc.o
--- linux-6.17.orig/mm/cma.h
+++ linux-6.17/mm/cma.h
@@ -49,7 +49,7 @@ struct cma {
char name[CMA_MAX_NAME];
int nranges;
struct cma_memrange ranges[CMA_MAX_RANGES];
-#ifdef CONFIG_CMA_SYSFS
+#ifdef CONFIG_SYSFS
/* the number of CMA page successful allocations */
atomic64_t nr_pages_succeeded;
/* the number of CMA page allocation failures */
@@ -80,7 +80,7 @@ static inline unsigned long cma_bitmap_m
return cmr->count >> cma->order_per_bit;
}
-#ifdef CONFIG_CMA_SYSFS
+#ifdef CONFIG_SYSFS
void cma_sysfs_account_success_pages(struct cma *cma, unsigned long nr_pages);
void cma_sysfs_account_fail_pages(struct cma *cma, unsigned long nr_pages);
void cma_sysfs_account_release_pages(struct cma *cma, unsigned long nr_pages);
--- linux-6.17.orig/mm/Kconfig
+++ linux-6.17/mm/Kconfig
@@ -981,13 +981,6 @@ config CMA_DEBUGFS
help
Turns on the DebugFS interface for CMA.
-config CMA_SYSFS
- bool "CMA information through sysfs interface"
- depends on CMA && SYSFS
- help
- This option exposes some sysfs attributes to get information
- from CMA.
-
config CMA_AREAS
int "Maximum count of the CMA areas"
depends on CMA
--
Jean Delvare
SUSE L3 Support
^ permalink raw reply [flat|nested] 7+ messages in thread* Re: [PATCH] mm/cma: Remove CONFIG_CMA_SYSFS option
2025-11-13 13:56 [PATCH] mm/cma: Remove CONFIG_CMA_SYSFS option Jean Delvare
@ 2025-11-13 15:35 ` David Hildenbrand (Red Hat)
2025-11-13 16:57 ` Jean Delvare
2025-11-14 1:09 ` SeongJae Park
2025-11-14 8:34 ` Oscar Salvador
2 siblings, 1 reply; 7+ messages in thread
From: David Hildenbrand (Red Hat) @ 2025-11-13 15:35 UTC (permalink / raw)
To: Jean Delvare, linux-mm; +Cc: LKML
On 13.11.25 14:56, Jean Delvare wrote:
> The sysfs interface to CMA has a marginal runtime cost and a small
> footprint, there's no reason not to include it in all kernels where
> the dependencies are satisfied.
>
> Signed-off-by: Jean Delvare <jdelvare@suse.de>
> ---
> As discussed with David:
> https://lkml.org/lkml/2025/8/6/371
Thanks for the reminder, it sounded familiar but I couldn't remember
when this was discussed.
Hoping this was properly compile-tested :)
Acked-by: David Hildenbrand (Red Hat) <david@kernel.org>
--
Cheers
David
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] mm/cma: Remove CONFIG_CMA_SYSFS option
2025-11-13 15:35 ` David Hildenbrand (Red Hat)
@ 2025-11-13 16:57 ` Jean Delvare
0 siblings, 0 replies; 7+ messages in thread
From: Jean Delvare @ 2025-11-13 16:57 UTC (permalink / raw)
To: David Hildenbrand (Red Hat); +Cc: linux-mm, LKML
On Thu, 13 Nov 2025 16:35:03 +0100, David Hildenbrand (Red Hat) wrote:
> On 13.11.25 14:56, Jean Delvare wrote:
> > The sysfs interface to CMA has a marginal runtime cost and a small
> > footprint, there's no reason not to include it in all kernels where
> > the dependencies are satisfied.
> >
> > Signed-off-by: Jean Delvare <jdelvare@suse.de>
> > ---
> > As discussed with David:
> > https://lkml.org/lkml/2025/8/6/371
>
> Thanks for the reminder, it sounded familiar but I couldn't remember
> when this was discussed.
>
> Hoping this was properly compile-tested :)
Yes of course, I build-tested with both CONFIG_SYSFS=y and CONFIG_SYSFS
disabled.
> Acked-by: David Hildenbrand (Red Hat) <david@kernel.org>
Thanks,
--
Jean Delvare
SUSE L3 Support
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] mm/cma: Remove CONFIG_CMA_SYSFS option
2025-11-13 13:56 [PATCH] mm/cma: Remove CONFIG_CMA_SYSFS option Jean Delvare
2025-11-13 15:35 ` David Hildenbrand (Red Hat)
@ 2025-11-14 1:09 ` SeongJae Park
2025-11-14 8:48 ` Jean Delvare
2025-11-14 8:34 ` Oscar Salvador
2 siblings, 1 reply; 7+ messages in thread
From: SeongJae Park @ 2025-11-14 1:09 UTC (permalink / raw)
To: Jean Delvare; +Cc: SeongJae Park, linux-mm, LKML, David Hildenbrand
On Thu, 13 Nov 2025 14:56:36 +0100 Jean Delvare <jdelvare@suse.de> wrote:
> The sysfs interface to CMA has a marginal runtime cost and a small
> footprint, there's no reason not to include it in all kernels where
> the dependencies are satisfied.
Overall change looks good to me. I have a question below, though.
>
> Signed-off-by: Jean Delvare <jdelvare@suse.de>
> ---
> As discussed with David:
> https://lkml.org/lkml/2025/8/6/371
>
> arch/loongarch/configs/loongson3_defconfig | 1 -
> arch/s390/configs/debug_defconfig | 1 -
> arch/s390/configs/defconfig | 1 -
> mm/Kconfig | 7 -------
> mm/Makefile | 4 +++-
> mm/cma.h | 4 ++--
> 6 files changed, 5 insertions(+), 13 deletions(-)
>
> --- linux-6.17.orig/arch/loongarch/configs/loongson3_defconfig
> +++ linux-6.17/arch/loongarch/configs/loongson3_defconfig
[...]
> --- linux-6.17.orig/mm/cma.h
> +++ linux-6.17/mm/cma.h
> @@ -49,7 +49,7 @@ struct cma {
> char name[CMA_MAX_NAME];
> int nranges;
> struct cma_memrange ranges[CMA_MAX_RANGES];
> -#ifdef CONFIG_CMA_SYSFS
> +#ifdef CONFIG_SYSFS
> /* the number of CMA page successful allocations */
> atomic64_t nr_pages_succeeded;
> /* the number of CMA page allocation failures */
> @@ -80,7 +80,7 @@ static inline unsigned long cma_bitmap_m
> return cmr->count >> cma->order_per_bit;
> }
>
> -#ifdef CONFIG_CMA_SYSFS
> +#ifdef CONFIG_SYSFS
> void cma_sysfs_account_success_pages(struct cma *cma, unsigned long nr_pages);
> void cma_sysfs_account_fail_pages(struct cma *cma, unsigned long nr_pages);
> void cma_sysfs_account_release_pages(struct cma *cma, unsigned long nr_pages);
Why don't you check CONFIG_CMA together? I think that makes the change more
complete and safe.
I found there is no file that can be compiled without CONFIG_CMA but still
including this header file, so I expect no real issue for now, though.
Thanks,
SJ
[...]
^ permalink raw reply [flat|nested] 7+ messages in thread* Re: [PATCH] mm/cma: Remove CONFIG_CMA_SYSFS option
2025-11-14 1:09 ` SeongJae Park
@ 2025-11-14 8:48 ` Jean Delvare
2025-11-14 15:47 ` SeongJae Park
0 siblings, 1 reply; 7+ messages in thread
From: Jean Delvare @ 2025-11-14 8:48 UTC (permalink / raw)
To: SeongJae Park; +Cc: linux-mm, LKML, David Hildenbrand
Hi Seong Jae,
On Thu, 13 Nov 2025 17:09:27 -0800, SeongJae Park wrote:
> On Thu, 13 Nov 2025 14:56:36 +0100 Jean Delvare <jdelvare@suse.de> wrote:
>
> > The sysfs interface to CMA has a marginal runtime cost and a small
> > footprint, there's no reason not to include it in all kernels where
> > the dependencies are satisfied.
>
> Overall change looks good to me. I have a question below, though.
>
> >
> > Signed-off-by: Jean Delvare <jdelvare@suse.de>
> > ---
> > As discussed with David:
> > https://lkml.org/lkml/2025/8/6/371
> >
> > arch/loongarch/configs/loongson3_defconfig | 1 -
> > arch/s390/configs/debug_defconfig | 1 -
> > arch/s390/configs/defconfig | 1 -
> > mm/Kconfig | 7 -------
> > mm/Makefile | 4 +++-
> > mm/cma.h | 4 ++--
> > 6 files changed, 5 insertions(+), 13 deletions(-)
> >
> > --- linux-6.17.orig/arch/loongarch/configs/loongson3_defconfig
> > +++ linux-6.17/arch/loongarch/configs/loongson3_defconfig
> [...]
> > --- linux-6.17.orig/mm/cma.h
> > +++ linux-6.17/mm/cma.h
> > @@ -49,7 +49,7 @@ struct cma {
> > char name[CMA_MAX_NAME];
> > int nranges;
> > struct cma_memrange ranges[CMA_MAX_RANGES];
> > -#ifdef CONFIG_CMA_SYSFS
> > +#ifdef CONFIG_SYSFS
> > /* the number of CMA page successful allocations */
> > atomic64_t nr_pages_succeeded;
> > /* the number of CMA page allocation failures */
> > @@ -80,7 +80,7 @@ static inline unsigned long cma_bitmap_m
> > return cmr->count >> cma->order_per_bit;
> > }
> >
> > -#ifdef CONFIG_CMA_SYSFS
> > +#ifdef CONFIG_SYSFS
> > void cma_sysfs_account_success_pages(struct cma *cma, unsigned long nr_pages);
> > void cma_sysfs_account_fail_pages(struct cma *cma, unsigned long nr_pages);
> > void cma_sysfs_account_release_pages(struct cma *cma, unsigned long nr_pages);
>
> Why don't you check CONFIG_CMA together? I think that makes the change more
> complete and safe.
>
> I found there is no file that can be compiled without CONFIG_CMA but still
> including this header file, so I expect no real issue for now, though.
This would actually make no difference. This header file is internal
and not expected to be included by any file besides that CMA core
itself, so it is assumed that CONFIG_CMA=y whenever this header file
is used. If not, then things would break already, even without my
proposed changes (due to cma_areas and cma_area_count being declared
but never defined).
--
Jean Delvare
SUSE L3 Support
^ permalink raw reply [flat|nested] 7+ messages in thread* Re: [PATCH] mm/cma: Remove CONFIG_CMA_SYSFS option
2025-11-14 8:48 ` Jean Delvare
@ 2025-11-14 15:47 ` SeongJae Park
0 siblings, 0 replies; 7+ messages in thread
From: SeongJae Park @ 2025-11-14 15:47 UTC (permalink / raw)
To: Jean Delvare; +Cc: SeongJae Park, linux-mm, LKML, David Hildenbrand
On Fri, 14 Nov 2025 09:48:14 +0100 Jean Delvare <jdelvare@suse.de> wrote:
> Hi Seong Jae,
>
> On Thu, 13 Nov 2025 17:09:27 -0800, SeongJae Park wrote:
> > On Thu, 13 Nov 2025 14:56:36 +0100 Jean Delvare <jdelvare@suse.de> wrote:
> >
> > > The sysfs interface to CMA has a marginal runtime cost and a small
> > > footprint, there's no reason not to include it in all kernels where
> > > the dependencies are satisfied.
> >
> > Overall change looks good to me. I have a question below, though.
> >
> > >
> > > Signed-off-by: Jean Delvare <jdelvare@suse.de>
> > > ---
> > > As discussed with David:
> > > https://lkml.org/lkml/2025/8/6/371
> > >
> > > arch/loongarch/configs/loongson3_defconfig | 1 -
> > > arch/s390/configs/debug_defconfig | 1 -
> > > arch/s390/configs/defconfig | 1 -
> > > mm/Kconfig | 7 -------
> > > mm/Makefile | 4 +++-
> > > mm/cma.h | 4 ++--
> > > 6 files changed, 5 insertions(+), 13 deletions(-)
> > >
> > > --- linux-6.17.orig/arch/loongarch/configs/loongson3_defconfig
> > > +++ linux-6.17/arch/loongarch/configs/loongson3_defconfig
> > [...]
> > > --- linux-6.17.orig/mm/cma.h
> > > +++ linux-6.17/mm/cma.h
> > > @@ -49,7 +49,7 @@ struct cma {
> > > char name[CMA_MAX_NAME];
> > > int nranges;
> > > struct cma_memrange ranges[CMA_MAX_RANGES];
> > > -#ifdef CONFIG_CMA_SYSFS
> > > +#ifdef CONFIG_SYSFS
> > > /* the number of CMA page successful allocations */
> > > atomic64_t nr_pages_succeeded;
> > > /* the number of CMA page allocation failures */
> > > @@ -80,7 +80,7 @@ static inline unsigned long cma_bitmap_m
> > > return cmr->count >> cma->order_per_bit;
> > > }
> > >
> > > -#ifdef CONFIG_CMA_SYSFS
> > > +#ifdef CONFIG_SYSFS
> > > void cma_sysfs_account_success_pages(struct cma *cma, unsigned long nr_pages);
> > > void cma_sysfs_account_fail_pages(struct cma *cma, unsigned long nr_pages);
> > > void cma_sysfs_account_release_pages(struct cma *cma, unsigned long nr_pages);
> >
> > Why don't you check CONFIG_CMA together? I think that makes the change more
> > complete and safe.
> >
> > I found there is no file that can be compiled without CONFIG_CMA but still
> > including this header file, so I expect no real issue for now, though.
>
> This would actually make no difference. This header file is internal
> and not expected to be included by any file besides that CMA core
> itself, so it is assumed that CONFIG_CMA=y whenever this header file
> is used. If not, then things would break already, even without my
> proposed changes (due to cma_areas and cma_area_count being declared
> but never defined).
Makes sense.
Reviewed-by: SeongJae Park <sj@kernel.org>
Thanks,
SJ
[...]
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] mm/cma: Remove CONFIG_CMA_SYSFS option
2025-11-13 13:56 [PATCH] mm/cma: Remove CONFIG_CMA_SYSFS option Jean Delvare
2025-11-13 15:35 ` David Hildenbrand (Red Hat)
2025-11-14 1:09 ` SeongJae Park
@ 2025-11-14 8:34 ` Oscar Salvador
2 siblings, 0 replies; 7+ messages in thread
From: Oscar Salvador @ 2025-11-14 8:34 UTC (permalink / raw)
To: Jean Delvare; +Cc: linux-mm, LKML, David Hildenbrand
On Thu, Nov 13, 2025 at 02:56:36PM +0100, Jean Delvare wrote:
> The sysfs interface to CMA has a marginal runtime cost and a small
> footprint, there's no reason not to include it in all kernels where
> the dependencies are satisfied.
>
> Signed-off-by: Jean Delvare <jdelvare@suse.de>
Acked-by: Oscar Salvador <osalvador@suse.de>
--
Oscar Salvador
SUSE Labs
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2025-11-14 15:48 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-11-13 13:56 [PATCH] mm/cma: Remove CONFIG_CMA_SYSFS option Jean Delvare
2025-11-13 15:35 ` David Hildenbrand (Red Hat)
2025-11-13 16:57 ` Jean Delvare
2025-11-14 1:09 ` SeongJae Park
2025-11-14 8:48 ` Jean Delvare
2025-11-14 15:47 ` SeongJae Park
2025-11-14 8:34 ` Oscar Salvador
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox