Skip to contentSkip to conversation

dma-contiguous: fix the Kconfig entry for CONFIG_DMA_NUMA_CMA

PATCH In review Christoph Hellwig 2 participants 4 messages Aug 30, 2023 DMA mapping helpers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 dma-contiguous: fix the Kconfig entry for CONFIG_DMA_NUMA_CMA

It makes no sense to expose CONFIG_DMA_NUMA_CMA if CONFIG_NUMA is not enabled, and random config options shouldn't be default unless there is a good reason. Replace the default NUMA with a depends on to fix both issues.

---
 kernel/dma/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/dma/Kconfig +1 -1
index 4c1e9a3c0ab6f0..f488997b071712 100644
@@ -160,7 +160,7 @@ if  DMA_CMA
 
 config DMA_NUMA_CMA
 	bool "Enable separate DMA Contiguous Memory Area for NUMA Node"
-	default NUMA
+	depends on NUMA
 	help
 	  Enable this option to get numa CMA areas so that NUMA devices
 	  can get local memory by DMA coherent APIs.
Signature · 1 line
2.39.2
reviewer Reviewed-by on v1 1/1
#1 lore raw
Quoted 4 lines · Christoph Hellwig

It makes no sense to expose CONFIG_DMA_NUMA_CMA if CONFIG_NUMA is not enabled, and random config options shouldn't be default unless there is a good reason. Replace the default NUMA with a depends on to fix both issues.

I think the "good reason" is that folks who do have NUMA systems are likely to be more interested in getting more consistent DMA performance than losing a bit more non-movable memory capacity, and the runtime impact on non-NUMA systems should be negligible, so I would definitely be inclined to make it "default y". But it's not critically important.

For the fundamental dependency change which absolutely makes sense,

Quoted 18 lines
---
  kernel/dma/Kconfig | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
kernel/dma/Kconfig +1 -1
index 4c1e9a3c0ab6f0..f488997b071712 100644
@@ -160,7 +160,7 @@ if  DMA_CMA
 
  config DMA_NUMA_CMA
  	bool "Enable separate DMA Contiguous Memory Area for NUMA Node"
-	default NUMA
+	depends on NUMA
  	help
  	  Enable this option to get numa CMA areas so that NUMA devices
  	  can get local memory by DMA coherent APIs.
#2 lore raw
Quoted 5 lines · Robin Murphy

I think the "good reason" is that folks who do have NUMA systems are likely to be more interested in getting more consistent DMA performance than losing a bit more non-movable memory capacity, and the runtime impact on non-NUMA systems should be negligible, so I would definitely be inclined to make it "default y". But it's not critically important.

Well, Linus hates these default y, and usually for a good reason. If it's that useful/importanst for numa systems we should just drop the option and make the code conditional on CONFIG_NUMA only.

reviewer
#3 lore raw
Quoted 10 lines · Christoph Hellwig
Quoted 5 lines · Robin Murphy

I think the "good reason" is that folks who do have NUMA systems are likely to be more interested in getting more consistent DMA performance than losing a bit more non-movable memory capacity, and the runtime impact on non-NUMA systems should be negligible, so I would definitely be inclined to make it "default y". But it's not critically important.

Well, Linus hates these default y, and usually for a good reason. If it's that useful/importanst for numa systems we should just drop the option and make the code conditional on CONFIG_NUMA only.

Hmm, good point. In fact, after double-checking, the amount of code saved by disabling it looks pretty trivial, and it does need an explicit command-line option to activate the "special" behaviour anyway, so indeed I'm now starting to doubt whether the separate config option is worthwhile at all.

Cheers,
Robin.