All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] mm/kconfig: Drop redundant dependency wrappers
@ 2026-07-12  9:33 Kaitao Cheng
  2026-07-14 13:28 ` David Hildenbrand (Arm)
  2026-07-14 14:24 ` Lorenzo Stoakes (ARM)
  0 siblings, 2 replies; 3+ messages in thread
From: Kaitao Cheng @ 2026-07-12  9:33 UTC (permalink / raw)
  To: Andrew Morton, David Hildenbrand, Lorenzo Stoakes,
	Liam R . Howlett, Vlastimil Babka, Mike Rapoport,
	Suren Baghdasaryan, Michal Hocko
  Cc: linux-mm, linux-kernel, Julian Braha, Muchun Song, Kaitao Cheng

From: Kaitao Cheng <chengkaitao@kylinos.cn>

Some mm Kconfig entries repeat dependencies that are already expressed by
their surrounding blocks or menus.

The zsmalloc allocator options menu already depends on ZSMALLOC, so the
outer if ZSMALLOC block does not add any extra constraint. MEMORY_HOTREMOVE
and MHP_MEMMAP_ON_MEMORY are both inside the if MEMORY_HOTPLUG block, so
their local depends on MEMORY_HOTPLUG entries are redundant.

PTE_MARKER_UFFD_WP is the only entry under if USERFAULTFD. Move the
USERFAULTFD dependency into the symbol itself and combine it with the
architecture support dependency.

This keeps the same visibility and defaults while avoiding duplicate
dependency expressions.

Suggested-by: Julian Braha <julianbraha@gmail.com>
Signed-off-by: Kaitao Cheng <chengkaitao@kylinos.cn>
---
 mm/Kconfig | 10 +---------
 1 file changed, 1 insertion(+), 9 deletions(-)

diff --git a/mm/Kconfig b/mm/Kconfig
index ff29f770d10a..7d1524e5c3d5 100644
--- a/mm/Kconfig
+++ b/mm/Kconfig
@@ -125,8 +125,6 @@ config ZSWAP_COMPRESSOR_DEFAULT
 config ZSMALLOC
 	tristate
 
-if ZSMALLOC
-
 menu "Zsmalloc allocator options"
 	depends on ZSMALLOC
 
@@ -161,8 +159,6 @@ config ZSMALLOC_CHAIN_SIZE
 
 endmenu
 
-endif
-
 menu "Slab allocator options"
 
 config SLUB
@@ -591,12 +587,10 @@ endchoice
 config MEMORY_HOTREMOVE
 	bool "Allow for memory hot remove"
 	select HAVE_BOOTMEM_INFO_NODE if X86_64
-	depends on MEMORY_HOTPLUG
 	select MIGRATION
 
 config MHP_MEMMAP_ON_MEMORY
 	def_bool y
-	depends on MEMORY_HOTPLUG
 	depends on ARCH_MHP_MEMMAP_ON_MEMORY_ENABLE
 
 endif # MEMORY_HOTPLUG
@@ -1391,17 +1385,15 @@ menuconfig USERFAULTFD
 	  Enable the userfaultfd() system call that allows to intercept and
 	  handle page faults in userland.
 
-if USERFAULTFD
 config PTE_MARKER_UFFD_WP
 	bool "Userfaultfd write protection support for shmem/hugetlbfs"
 	default y
-	depends on HAVE_ARCH_USERFAULTFD_WP
+	depends on USERFAULTFD && HAVE_ARCH_USERFAULTFD_WP
 
 	help
 	  Allows to create marker PTEs for userfaultfd write protection
 	  purposes.  It is required to enable userfaultfd write protection on
 	  file-backed memory types like shmem and hugetlbfs.
-endif # USERFAULTFD
 
 # multi-gen LRU {
 config LRU_GEN
-- 
2.50.1 (Apple Git-155)


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

* Re: [PATCH] mm/kconfig: Drop redundant dependency wrappers
  2026-07-12  9:33 [PATCH] mm/kconfig: Drop redundant dependency wrappers Kaitao Cheng
@ 2026-07-14 13:28 ` David Hildenbrand (Arm)
  2026-07-14 14:24 ` Lorenzo Stoakes (ARM)
  1 sibling, 0 replies; 3+ messages in thread
From: David Hildenbrand (Arm) @ 2026-07-14 13:28 UTC (permalink / raw)
  To: Kaitao Cheng, Andrew Morton, Lorenzo Stoakes, Liam R . Howlett,
	Vlastimil Babka, Mike Rapoport, Suren Baghdasaryan, Michal Hocko
  Cc: linux-mm, linux-kernel, Julian Braha, Muchun Song, Kaitao Cheng

On 7/12/26 11:33, Kaitao Cheng wrote:
> From: Kaitao Cheng <chengkaitao@kylinos.cn>
> 
> Some mm Kconfig entries repeat dependencies that are already expressed by
> their surrounding blocks or menus.
> 
> The zsmalloc allocator options menu already depends on ZSMALLOC, so the
> outer if ZSMALLOC block does not add any extra constraint. MEMORY_HOTREMOVE
> and MHP_MEMMAP_ON_MEMORY are both inside the if MEMORY_HOTPLUG block, so
> their local depends on MEMORY_HOTPLUG entries are redundant.
> 
> PTE_MARKER_UFFD_WP is the only entry under if USERFAULTFD. Move the
> USERFAULTFD dependency into the symbol itself and combine it with the
> architecture support dependency.
> 
> This keeps the same visibility and defaults while avoiding duplicate
> dependency expressions.
> 
> Suggested-by: Julian Braha <julianbraha@gmail.com>
> Signed-off-by: Kaitao Cheng <chengkaitao@kylinos.cn>
> ---

Acked-by: David Hildenbrand (Arm) <david@kernel.org>

-- 
Cheers,

David

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

* Re: [PATCH] mm/kconfig: Drop redundant dependency wrappers
  2026-07-12  9:33 [PATCH] mm/kconfig: Drop redundant dependency wrappers Kaitao Cheng
  2026-07-14 13:28 ` David Hildenbrand (Arm)
@ 2026-07-14 14:24 ` Lorenzo Stoakes (ARM)
  1 sibling, 0 replies; 3+ messages in thread
From: Lorenzo Stoakes (ARM) @ 2026-07-14 14:24 UTC (permalink / raw)
  To: Kaitao Cheng
  Cc: Andrew Morton, David Hildenbrand, Lorenzo Stoakes,
	Liam R . Howlett, Vlastimil Babka, Mike Rapoport,
	Suren Baghdasaryan, Michal Hocko, linux-mm, linux-kernel,
	Julian Braha, Muchun Song, Kaitao Cheng

On Sun, 12 Jul 2026 17:33:26 +0800, Kaitao Cheng <kaitao.cheng@linux.dev> wrote:
> [...]
> 
> This keeps the same visibility and defaults while avoiding duplicate
> dependency expressions.
> 
> Suggested-by: Julian Braha <julianbraha@gmail.com>
> Signed-off-by: Kaitao Cheng <chengkaitao@kylinos.cn>

LGTM!

>
>
> diff --git a/mm/Kconfig b/mm/Kconfig
> index 4efff892820d..eaff45c9f7b7 100644
> --- a/mm/Kconfig
> +++ b/mm/Kconfig
> @@ -591,12 +587,10 @@ endchoice
>  config MEMORY_HOTREMOVE
>  	bool "Allow for memory hot remove"
>  	select HAVE_BOOTMEM_INFO_NODE if X86_64
> -	depends on MEMORY_HOTPLUG
>  	select MIGRATION
>  
>  config MHP_MEMMAP_ON_MEMORY
>  	def_bool y
> -	depends on MEMORY_HOTPLUG

Honestly I hate that we have both if and depends on, I'd rather we just had
depends on so we had consistency everywhere :) but it's not your fault, just a
gripe with Kconfig in general! :)

> @@ -1391,17 +1385,15 @@ menuconfig USERFAULTFD
> [ ... skip 12 lines ... ]
>  	  purposes.  It is required to enable userfaultfd write protection on
>  	  file-backed memory types like shmem and hugetlbfs.
> -endif # USERFAULTFD
>  
>  # multi-gen LRU {
>  config LRU_GEN

Cheers, Lorenzo

Reviewed-by: Lorenzo Stoakes (ARM) <ljs@kernel.org>

-- 
Lorenzo Stoakes (ARM) <ljs@kernel.org>


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

end of thread, other threads:[~2026-07-14 14:24 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-12  9:33 [PATCH] mm/kconfig: Drop redundant dependency wrappers Kaitao Cheng
2026-07-14 13:28 ` David Hildenbrand (Arm)
2026-07-14 14:24 ` Lorenzo Stoakes (ARM)

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.