mm/thp: dead code cleanup in Kconfig
Subsystems (2)
PATCH 1/1 mm/thp: dead code cleanup in Kconfig
There is already an 'if TRANSPARENT_HUGEPAGE' condition wrapping several config options e.g. 'READ_ONLY_THP_FOR_FS', making
the 'depends on' statement for each of these a duplicate dependency (dead code).
I propose leaving the outer 'if TRANSPARENT_HUGEPAGE...endif' and removing the individual 'depends on TRANSPARENT_HUGEPAGE' statement from each option.
This dead code was found by kconfirm, a static analysis tool for Kconfig.
--- mm/Kconfig | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-)
mm/Kconfig +1 -5
@@ -810,7 +810,6 @@ if TRANSPARENT_HUGEPAGE choice prompt "Transparent Hugepage Support sysfs defaults" - depends on TRANSPARENT_HUGEPAGE default TRANSPARENT_HUGEPAGE_ALWAYS help Selects the sysfs defaults for Transparent Hugepage Support.
@@ -840,7 +839,6 @@ endchoice choice prompt "Shmem hugepage allocation defaults" - depends on TRANSPARENT_HUGEPAGE default TRANSPARENT_HUGEPAGE_SHMEM_HUGE_NEVER help Selects the hugepage allocation policy defaults for
@@ -886,7 +884,6 @@ endchoice choice prompt "Tmpfs hugepage allocation defaults" - depends on TRANSPARENT_HUGEPAGE default TRANSPARENT_HUGEPAGE_TMPFS_HUGE_NEVER help Selects the hugepage allocation policy defaults for
@@ -931,7 +928,7 @@ endchoice config THP_SWAP def_bool y - depends on TRANSPARENT_HUGEPAGE && ARCH_WANTS_THP_SWAP && SWAP && 64BIT + depends on ARCH_WANTS_THP_SWAP && SWAP && 64BIT help Swap transparent huge pages in one piece, without splitting. XXX: For now, swap cluster backing transparent huge page
@@ -941,7 +938,6 @@ config THP_SWAP config READ_ONLY_THP_FOR_FS bool "Read-only THP for filesystems (EXPERIMENTAL)" - depends on TRANSPARENT_HUGEPAGE help Allow khugepaged to put read-only file-backed pages in THP.
Signature · 1 line
2.51.2
Quoted 10 lines · Julian Braha
There is already an 'if
TRANSPARENT_HUGEPAGE' condition wrapping several config options e.g. 'READ_ONLY_THP_FOR_FS', making
the 'depends on' statement for each of these a duplicate dependency (dead code).I propose leaving the outer 'if TRANSPARENT_HUGEPAGE...endif' and removing the individual 'depends on
TRANSPARENT_HUGEPAGE' statement from each option.This dead code was found by kconfirm, a static analysis tool for
Kconfig.
Thanks for acking tooling used :) much appreciated.
Quoted 2 lines
Signed-off-by Julian Braha <[email protected]>
Unless there's some weird semantics I'm not aware of, this LGTM, so:
Quoted 52 lines
--- mm/Kconfig | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-)mm/Kconfig +1
-6@@ -810,7 +810,6 @@ if TRANSPARENT_HUGEPAGE choice prompt "Transparent Hugepage Support sysfs defaults" - depends on TRANSPARENT_HUGEPAGE default TRANSPARENT_HUGEPAGE_ALWAYS help Selects the sysfs defaults for Transparent Hugepage Support.@@ -840,7 +839,6 @@ endchoice choice prompt "Shmem hugepage allocation defaults" - depends on TRANSPARENT_HUGEPAGE default TRANSPARENT_HUGEPAGE_SHMEM_HUGE_NEVER help Selects the hugepage allocation policy defaults for@@ -886,7 +884,6 @@ endchoice choice prompt "Tmpfs hugepage allocation defaults" - depends on TRANSPARENT_HUGEPAGE default TRANSPARENT_HUGEPAGE_TMPFS_HUGE_NEVER help Selects the hugepage allocation policy defaults for@@ -931,7 +928,7 @@ endchoice config THP_SWAP def_bool y - depends on TRANSPARENT_HUGEPAGE && ARCH_WANTS_THP_SWAP && SWAP && 64BIT + depends on ARCH_WANTS_THP_SWAP && SWAP && 64BIT help Swap transparent huge pages in one piece, without splitting. XXX: For now, swap cluster backing transparent huge page@@ -941,7 +938,6 @@ config THP_SWAP config READ_ONLY_THP_FOR_FS bool "Read-only THP for filesystems (EXPERIMENTAL)" - depends on TRANSPARENT_HUGEPAGE help Allow khugepaged to put read-only file-backed pages in THP. --2.51.2
Andrew Morton
maintainerQuoted 6 lines · On Tue, 31 Mar 2026 08:22:32 +0100 "Lorenzo Stoakes (Oracle)" <[email protected]>…
Quoted 5 lines · Julian Braha
There is already an 'if
TRANSPARENT_HUGEPAGE' condition wrapping several config options e.g. 'READ_ONLY_THP_FOR_FS', making
the 'depends on' statement for each of these a duplicate dependency (dead code).
Quoted 7 lines
Quoted 5 lines
I propose leaving the outer 'if TRANSPARENT_HUGEPAGE...endif' and removing the individual 'depends on
TRANSPARENT_HUGEPAGE' statement from each option.This dead code was found by kconfirm, a static analysis tool for
Kconfig.Thanks for acking tooling used :) much appreciated.
OK, I give up. Where do I learn about kconfirm?
Quoted 6 lines
Quoted 2 lines
Signed-off-by Julian Braha <[email protected]>Unless there's some weird semantics I'm not aware of, this LGTM, so:
Reviewed-by Lorenzo Stoakes (Oracle) <[email protected]>
Thanks. I'll add this to my (small!) post-rc1 pile.
Hi Andrew,
I've just made a proper announcement of kconfirm on the mailing list:
https://lore.kernel.org/all/[email protected]/T/#u
Additionally, the code is available here:
https://github.com/julianbraha/kconfirm
Best regards,
Julian Braha
Andrew Morton
maintainerQuoted 4 lines · On Sun, 5 Apr 2026 18:18:14 +0100 Julian Braha <[email protected]> wrote:
Hi Andrew,
I've just made a proper announcement of kconfirm on the mailing list:
https://lore.kernel.org/all/[email protected]/T/#u
Looks neat, thanks. I don't know how much uptake you'll get from others and I expect that addressing all those flaws yourself would be a long project! However...
Quoted 2 lines
Additionally, the code is available here:
https://github.com/julianbraha/kconfirm
Have you considered adding kconfirm to the tree? A top-level `make kconfirm' should help move things along?
Quoted 1 line
Have you considered adding kconfirm to the tree? A top-level `make
kconfirm' should help move things along?
Actually I would love to move the tool into the tree. I will clean up the code a bit and create an RFC soon.
Best regards,
Julian Braha
Lorenzo Stoakes (Oracle)
reviewerQuoted 2 lines · Julian Braha
Quoted 1 line
Have you considered adding kconfirm to the tree? A top-level `make
kconfirm' should help move things along?
+1 to this!
Quoted 3 lines
Actually I would love to move the tool into the tree. I will clean up the code a bit and create an RFC soon.
Thanks :)
Quoted 3 lines
Best regards,
Julian Braha
Cheers, Lorenzo
Quoted 5 lines · Julian Braha
There is already an 'if
TRANSPARENT_HUGEPAGE' condition wrapping several config options e.g. 'READ_ONLY_THP_FOR_FS', making
the 'depends on' statement for each of these a duplicate dependency (dead code).
Quoted 7 lines
I propose leaving the outer 'if TRANSPARENT_HUGEPAGE...endif' and removing the individual 'depends on
TRANSPARENT_HUGEPAGE' statement from each option.This dead code was found by kconfirm, a static analysis tool for
Kconfig.Signed-off-by Julian Braha <[email protected]>
Signature · 3 lines
Cheers, David
Quoted 5 lines · Julian Braha
There is already an 'if
TRANSPARENT_HUGEPAGE' condition wrapping several config options e.g. 'READ_ONLY_THP_FOR_FS', making
the 'depends on' statement for each of these a duplicate dependency (dead code).
Quoted 7 lines
I propose leaving the outer 'if TRANSPARENT_HUGEPAGE...endif' and removing the individual 'depends on
TRANSPARENT_HUGEPAGE' statement from each option.This dead code was found by kconfirm, a static analysis tool for
Kconfig.Signed-off-by Julian Braha <[email protected]>
Quoted 49 lines
--- mm/Kconfig | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-)mm/Kconfig +1
-5@@ -810,7 +810,6 @@ if TRANSPARENT_HUGEPAGE choice prompt "Transparent Hugepage Support sysfs defaults" - depends on TRANSPARENT_HUGEPAGE default TRANSPARENT_HUGEPAGE_ALWAYS help Selects the sysfs defaults for Transparent Hugepage Support.@@ -840,7 +839,6 @@ endchoice choice prompt "Shmem hugepage allocation defaults" - depends on TRANSPARENT_HUGEPAGE default TRANSPARENT_HUGEPAGE_SHMEM_HUGE_NEVER help Selects the hugepage allocation policy defaults for@@ -886,7 +884,6 @@ endchoice choice prompt "Tmpfs hugepage allocation defaults" - depends on TRANSPARENT_HUGEPAGE default TRANSPARENT_HUGEPAGE_TMPFS_HUGE_NEVER help Selects the hugepage allocation policy defaults for@@ -931,7 +928,7 @@ endchoice config THP_SWAP def_bool y - depends on TRANSPARENT_HUGEPAGE && ARCH_WANTS_THP_SWAP && SWAP && 64BIT + depends on ARCH_WANTS_THP_SWAP && SWAP && 64BIT help Swap transparent huge pages in one piece, without splitting. XXX: For now, swap cluster backing transparent huge page@@ -941,7 +938,6 @@ config THP_SWAP config READ_ONLY_THP_FOR_FS bool "Read-only THP for filesystems (EXPERIMENTAL)" - depends on TRANSPARENT_HUGEPAGE help Allow khugepaged to put read-only file-backed pages in THP.