diff mbox series

[v2,2/2] m/hugetlb: Rename ARCH_WANT_HUGETLB_PAGE_OPTIMIZE_VMEMMAP

Message ID 20230411141818.62152-2-aneesh.kumar@linux.ibm.com (mailing list archive)
State New
Headers show
Series [v2,1/2] mm/vmemmap/devdax: Fix kernel crash when probing devdax devices | expand

Commit Message

Aneesh Kumar K.V April 11, 2023, 2:18 p.m. UTC
Now we use ARCH_WANT_HUGETLB_PAGE_OPTIMIZE_VMEMMAP config option
to indicate devdax and hugetlb vmemmap optimization support. Hence
rename that to a generic ARCH_WANT_OPTIMIZE_VMEMMAP

Cc: Joao Martins <joao.m.martins@oracle.com>
Cc: Muchun Song <songmuchun@bytedance.com>
Cc: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.ibm.com>
---
 arch/arm64/Kconfig     | 2 +-
 arch/loongarch/Kconfig | 2 +-
 arch/s390/Kconfig      | 2 +-
 arch/x86/Kconfig       | 2 +-
 fs/Kconfig             | 9 +--------
 include/linux/mm.h     | 2 +-
 mm/Kconfig             | 6 ++++++
 7 files changed, 12 insertions(+), 13 deletions(-)

Comments

Joao Martins April 11, 2023, 3:52 p.m. UTC | #1
[subject line should be mm/hugetlb as opposed to m/hugetlb]

On 11/04/2023 15:18, Aneesh Kumar K.V wrote:
> Now we use ARCH_WANT_HUGETLB_PAGE_OPTIMIZE_VMEMMAP config option
> to indicate devdax and hugetlb vmemmap optimization support. Hence
> rename that to a generic ARCH_WANT_OPTIMIZE_VMEMMAP
> 
> Cc: Joao Martins <joao.m.martins@oracle.com>
> Cc: Muchun Song <songmuchun@bytedance.com>
> Cc: Dan Williams <dan.j.williams@intel.com>
> Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.ibm.com>

+Mike from hugetlb

> ---
>  arch/arm64/Kconfig     | 2 +-
>  arch/loongarch/Kconfig | 2 +-
>  arch/s390/Kconfig      | 2 +-
>  arch/x86/Kconfig       | 2 +-
>  fs/Kconfig             | 9 +--------
>  include/linux/mm.h     | 2 +-
>  mm/Kconfig             | 6 ++++++
>  7 files changed, 12 insertions(+), 13 deletions(-)
> 
> diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
> index 27b2592698b0..77d9713dcd9c 100644
> --- a/arch/arm64/Kconfig
> +++ b/arch/arm64/Kconfig
> @@ -100,9 +100,9 @@ config ARM64
>  	select ARCH_WANT_DEFAULT_TOPDOWN_MMAP_LAYOUT
>  	select ARCH_WANT_FRAME_POINTERS
>  	select ARCH_WANT_HUGE_PMD_SHARE if ARM64_4K_PAGES || (ARM64_16K_PAGES && !ARM64_VA_BITS_36)
> -	select ARCH_WANT_HUGETLB_PAGE_OPTIMIZE_VMEMMAP
>  	select ARCH_WANT_LD_ORPHAN_WARN
>  	select ARCH_WANTS_NO_INSTR
> +	select ARCH_WANT_OPTIMIZE_VMEMMAP

Why don't you just change the line you just deleted?

>  	select ARCH_WANTS_THP_SWAP if ARM64_4K_PAGES
>  	select ARCH_HAS_UBSAN_SANITIZE_ALL
>  	select ARM_AMBA
> diff --git a/arch/loongarch/Kconfig b/arch/loongarch/Kconfig
> index 9cc8b84f7eb0..9cb00f962de1 100644
> --- a/arch/loongarch/Kconfig
> +++ b/arch/loongarch/Kconfig
> @@ -53,9 +53,9 @@ config LOONGARCH
>  	select ARCH_USE_QUEUED_RWLOCKS
>  	select ARCH_USE_QUEUED_SPINLOCKS
>  	select ARCH_WANT_DEFAULT_TOPDOWN_MMAP_LAYOUT
> -	select ARCH_WANT_HUGETLB_PAGE_OPTIMIZE_VMEMMAP
>  	select ARCH_WANT_LD_ORPHAN_WARN
>  	select ARCH_WANTS_NO_INSTR
> +	select ARCH_WANT_OPTIMIZE_VMEMMAP

Same comment here

>  	select BUILDTIME_TABLE_SORT
>  	select COMMON_CLK
>  	select CPU_PM
> diff --git a/arch/s390/Kconfig b/arch/s390/Kconfig
> index 933771b0b07a..df2cd510480a 100644
> --- a/arch/s390/Kconfig
> +++ b/arch/s390/Kconfig
> @@ -126,7 +126,7 @@ config S390
>  	select ARCH_WANTS_NO_INSTR
>  	select ARCH_WANT_DEFAULT_BPF_JIT
>  	select ARCH_WANT_IPC_PARSE_VERSION
> -	select ARCH_WANT_HUGETLB_PAGE_OPTIMIZE_VMEMMAP
> +	select ARCH_WANT_OPTIMIZE_VMEMMAP
>  	select BUILDTIME_TABLE_SORT
>  	select CLONE_BACKWARDS2
>  	select DMA_OPS if PCI

This one is good

> diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
> index a825bf031f49..5269131cc248 100644
> --- a/arch/x86/Kconfig
> +++ b/arch/x86/Kconfig
> @@ -125,8 +125,8 @@ config X86
>  	select ARCH_WANTS_NO_INSTR
>  	select ARCH_WANT_GENERAL_HUGETLB
>  	select ARCH_WANT_HUGE_PMD_SHARE
> -	select ARCH_WANT_HUGETLB_PAGE_OPTIMIZE_VMEMMAP	if X86_64
>  	select ARCH_WANT_LD_ORPHAN_WARN
> +	select ARCH_WANT_OPTIMIZE_VMEMMAP	if X86_64
>  	select ARCH_WANTS_THP_SWAP		if X86_64
>  	select ARCH_HAS_PARANOID_L1D_FLUSH
>  	select BUILDTIME_TABLE_SORT

Same comment here

> diff --git a/fs/Kconfig b/fs/Kconfig
> index e99830c65033..cc07a0cd3172 100644
> --- a/fs/Kconfig
> +++ b/fs/Kconfig
> @@ -250,16 +250,9 @@ config HUGETLBFS
>  config HUGETLB_PAGE
>  	def_bool HUGETLBFS
>  
> -#
> -# Select this config option from the architecture Kconfig, if it is preferred
> -# to enable the feature of HugeTLB Vmemmap Optimization (HVO).
> -#
> -config ARCH_WANT_HUGETLB_PAGE_OPTIMIZE_VMEMMAP
> -	bool
> -
>  config HUGETLB_PAGE_OPTIMIZE_VMEMMAP
>  	def_bool HUGETLB_PAGE
> -	depends on ARCH_WANT_HUGETLB_PAGE_OPTIMIZE_VMEMMAP
> +	depends on ARCH_WANT_OPTIMIZE_VMEMMAP
>  	depends on SPARSEMEM_VMEMMAP
>  
>  config HUGETLB_PAGE_OPTIMIZE_VMEMMAP_DEFAULT_ON
> diff --git a/include/linux/mm.h b/include/linux/mm.h
> index c47f2186d2c2..fb71e21df23d 100644
> --- a/include/linux/mm.h
> +++ b/include/linux/mm.h
> @@ -3443,7 +3443,7 @@ void vmemmap_free(unsigned long start, unsigned long end,
>  		struct vmem_altmap *altmap);
>  #endif
>  
> -#ifdef CONFIG_ARCH_WANT_HUGETLB_PAGE_OPTIMIZE_VMEMMA
> +#ifdef CONFIG_ARCH_WANT_OPTIMIZE_VMEMMAP
>  static inline bool vmemmap_can_optimize(struct vmem_altmap *altmap,
>  					   struct dev_pagemap *pgmap)
>  {
> diff --git a/mm/Kconfig b/mm/Kconfig
> index ff7b209dec05..492919cf62a4 100644
> --- a/mm/Kconfig
> +++ b/mm/Kconfig
> @@ -460,6 +460,12 @@ config SPARSEMEM_VMEMMAP
>  	  SPARSEMEM_VMEMMAP uses a virtually mapped memmap to optimise
>  	  pfn_to_page and page_to_pfn operations.  This is the most
>  	  efficient option when sufficient kernel resources are available.
> +#
> +# Select this config option from the architecture Kconfig, if it is preferred
> +# to enable the feature of HugeTLB/dev_dax vmemmap optimization.
> +#
> +config ARCH_WANT_OPTIMIZE_VMEMMAP
> +	bool
>  
>  config HAVE_MEMBLOCK_PHYS_MAP
>  	bool
Aneesh Kumar K.V April 11, 2023, 4:14 p.m. UTC | #2
On 4/11/23 9:22 PM, Joao Martins wrote:
> [subject line should be mm/hugetlb as opposed to m/hugetlb]
> 
> On 11/04/2023 15:18, Aneesh Kumar K.V wrote:
>> Now we use ARCH_WANT_HUGETLB_PAGE_OPTIMIZE_VMEMMAP config option
>> to indicate devdax and hugetlb vmemmap optimization support. Hence
>> rename that to a generic ARCH_WANT_OPTIMIZE_VMEMMAP
>>
>> Cc: Joao Martins <joao.m.martins@oracle.com>
>> Cc: Muchun Song <songmuchun@bytedance.com>
>> Cc: Dan Williams <dan.j.williams@intel.com>
>> Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.ibm.com>
> 
> +Mike from hugetlb
> 
>> ---
>>  arch/arm64/Kconfig     | 2 +-
>>  arch/loongarch/Kconfig | 2 +-
>>  arch/s390/Kconfig      | 2 +-
>>  arch/x86/Kconfig       | 2 +-
>>  fs/Kconfig             | 9 +--------
>>  include/linux/mm.h     | 2 +-
>>  mm/Kconfig             | 6 ++++++
>>  7 files changed, 12 insertions(+), 13 deletions(-)
>>
>> diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
>> index 27b2592698b0..77d9713dcd9c 100644
>> --- a/arch/arm64/Kconfig
>> +++ b/arch/arm64/Kconfig
>> @@ -100,9 +100,9 @@ config ARM64
>>  	select ARCH_WANT_DEFAULT_TOPDOWN_MMAP_LAYOUT
>>  	select ARCH_WANT_FRAME_POINTERS
>>  	select ARCH_WANT_HUGE_PMD_SHARE if ARM64_4K_PAGES || (ARM64_16K_PAGES && !ARM64_VA_BITS_36)
>> -	select ARCH_WANT_HUGETLB_PAGE_OPTIMIZE_VMEMMAP
>>  	select ARCH_WANT_LD_ORPHAN_WARN
>>  	select ARCH_WANTS_NO_INSTR
>> +	select ARCH_WANT_OPTIMIZE_VMEMMAP
> 
> Why don't you just change the line you just deleted?
> 

Those config select statements are sorted? 

-aneesh
Joao Martins April 11, 2023, 5:34 p.m. UTC | #3
On 11/04/2023 17:14, Aneesh Kumar K V wrote:
> On 4/11/23 9:22 PM, Joao Martins wrote:
>> [subject line should be mm/hugetlb as opposed to m/hugetlb]
>>
>> On 11/04/2023 15:18, Aneesh Kumar K.V wrote:
>>> Now we use ARCH_WANT_HUGETLB_PAGE_OPTIMIZE_VMEMMAP config option
>>> to indicate devdax and hugetlb vmemmap optimization support. Hence
>>> rename that to a generic ARCH_WANT_OPTIMIZE_VMEMMAP
>>>
>>> Cc: Joao Martins <joao.m.martins@oracle.com>
>>> Cc: Muchun Song <songmuchun@bytedance.com>
>>> Cc: Dan Williams <dan.j.williams@intel.com>
>>> Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.ibm.com>
>>
>> +Mike from hugetlb
>>
>>> ---
>>>  arch/arm64/Kconfig     | 2 +-
>>>  arch/loongarch/Kconfig | 2 +-
>>>  arch/s390/Kconfig      | 2 +-
>>>  arch/x86/Kconfig       | 2 +-
>>>  fs/Kconfig             | 9 +--------
>>>  include/linux/mm.h     | 2 +-
>>>  mm/Kconfig             | 6 ++++++
>>>  7 files changed, 12 insertions(+), 13 deletions(-)
>>>
>>> diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
>>> index 27b2592698b0..77d9713dcd9c 100644
>>> --- a/arch/arm64/Kconfig
>>> +++ b/arch/arm64/Kconfig
>>> @@ -100,9 +100,9 @@ config ARM64
>>>  	select ARCH_WANT_DEFAULT_TOPDOWN_MMAP_LAYOUT
>>>  	select ARCH_WANT_FRAME_POINTERS
>>>  	select ARCH_WANT_HUGE_PMD_SHARE if ARM64_4K_PAGES || (ARM64_16K_PAGES && !ARM64_VA_BITS_36)
>>> -	select ARCH_WANT_HUGETLB_PAGE_OPTIMIZE_VMEMMAP
>>>  	select ARCH_WANT_LD_ORPHAN_WARN
>>>  	select ARCH_WANTS_NO_INSTR
>>> +	select ARCH_WANT_OPTIMIZE_VMEMMAP
>>
>> Why don't you just change the line you just deleted?
>>
> 
> Those config select statements are sorted? 

/me facepalm

Totally missed that.
Muchun Song April 12, 2023, 3:43 a.m. UTC | #4
On Tue, Apr 11, 2023 at 10:18 PM Aneesh Kumar K.V
<aneesh.kumar@linux.ibm.com> wrote:
>
> Now we use ARCH_WANT_HUGETLB_PAGE_OPTIMIZE_VMEMMAP config option
> to indicate devdax and hugetlb vmemmap optimization support. Hence
> rename that to a generic ARCH_WANT_OPTIMIZE_VMEMMAP
>
> Cc: Joao Martins <joao.m.martins@oracle.com>
> Cc: Muchun Song <songmuchun@bytedance.com>
> Cc: Dan Williams <dan.j.williams@intel.com>
> Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.ibm.com>

I suggest rewording the prefix of subject to "mm/hugetlb_vmemmap:".
Renaming LGTM.

Reviewed-by: Muchun Song <songmuchun@bytedance.com>

Thanks.
diff mbox series

Patch

diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
index 27b2592698b0..77d9713dcd9c 100644
--- a/arch/arm64/Kconfig
+++ b/arch/arm64/Kconfig
@@ -100,9 +100,9 @@  config ARM64
 	select ARCH_WANT_DEFAULT_TOPDOWN_MMAP_LAYOUT
 	select ARCH_WANT_FRAME_POINTERS
 	select ARCH_WANT_HUGE_PMD_SHARE if ARM64_4K_PAGES || (ARM64_16K_PAGES && !ARM64_VA_BITS_36)
-	select ARCH_WANT_HUGETLB_PAGE_OPTIMIZE_VMEMMAP
 	select ARCH_WANT_LD_ORPHAN_WARN
 	select ARCH_WANTS_NO_INSTR
+	select ARCH_WANT_OPTIMIZE_VMEMMAP
 	select ARCH_WANTS_THP_SWAP if ARM64_4K_PAGES
 	select ARCH_HAS_UBSAN_SANITIZE_ALL
 	select ARM_AMBA
diff --git a/arch/loongarch/Kconfig b/arch/loongarch/Kconfig
index 9cc8b84f7eb0..9cb00f962de1 100644
--- a/arch/loongarch/Kconfig
+++ b/arch/loongarch/Kconfig
@@ -53,9 +53,9 @@  config LOONGARCH
 	select ARCH_USE_QUEUED_RWLOCKS
 	select ARCH_USE_QUEUED_SPINLOCKS
 	select ARCH_WANT_DEFAULT_TOPDOWN_MMAP_LAYOUT
-	select ARCH_WANT_HUGETLB_PAGE_OPTIMIZE_VMEMMAP
 	select ARCH_WANT_LD_ORPHAN_WARN
 	select ARCH_WANTS_NO_INSTR
+	select ARCH_WANT_OPTIMIZE_VMEMMAP
 	select BUILDTIME_TABLE_SORT
 	select COMMON_CLK
 	select CPU_PM
diff --git a/arch/s390/Kconfig b/arch/s390/Kconfig
index 933771b0b07a..df2cd510480a 100644
--- a/arch/s390/Kconfig
+++ b/arch/s390/Kconfig
@@ -126,7 +126,7 @@  config S390
 	select ARCH_WANTS_NO_INSTR
 	select ARCH_WANT_DEFAULT_BPF_JIT
 	select ARCH_WANT_IPC_PARSE_VERSION
-	select ARCH_WANT_HUGETLB_PAGE_OPTIMIZE_VMEMMAP
+	select ARCH_WANT_OPTIMIZE_VMEMMAP
 	select BUILDTIME_TABLE_SORT
 	select CLONE_BACKWARDS2
 	select DMA_OPS if PCI
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index a825bf031f49..5269131cc248 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -125,8 +125,8 @@  config X86
 	select ARCH_WANTS_NO_INSTR
 	select ARCH_WANT_GENERAL_HUGETLB
 	select ARCH_WANT_HUGE_PMD_SHARE
-	select ARCH_WANT_HUGETLB_PAGE_OPTIMIZE_VMEMMAP	if X86_64
 	select ARCH_WANT_LD_ORPHAN_WARN
+	select ARCH_WANT_OPTIMIZE_VMEMMAP	if X86_64
 	select ARCH_WANTS_THP_SWAP		if X86_64
 	select ARCH_HAS_PARANOID_L1D_FLUSH
 	select BUILDTIME_TABLE_SORT
diff --git a/fs/Kconfig b/fs/Kconfig
index e99830c65033..cc07a0cd3172 100644
--- a/fs/Kconfig
+++ b/fs/Kconfig
@@ -250,16 +250,9 @@  config HUGETLBFS
 config HUGETLB_PAGE
 	def_bool HUGETLBFS
 
-#
-# Select this config option from the architecture Kconfig, if it is preferred
-# to enable the feature of HugeTLB Vmemmap Optimization (HVO).
-#
-config ARCH_WANT_HUGETLB_PAGE_OPTIMIZE_VMEMMAP
-	bool
-
 config HUGETLB_PAGE_OPTIMIZE_VMEMMAP
 	def_bool HUGETLB_PAGE
-	depends on ARCH_WANT_HUGETLB_PAGE_OPTIMIZE_VMEMMAP
+	depends on ARCH_WANT_OPTIMIZE_VMEMMAP
 	depends on SPARSEMEM_VMEMMAP
 
 config HUGETLB_PAGE_OPTIMIZE_VMEMMAP_DEFAULT_ON
diff --git a/include/linux/mm.h b/include/linux/mm.h
index c47f2186d2c2..fb71e21df23d 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -3443,7 +3443,7 @@  void vmemmap_free(unsigned long start, unsigned long end,
 		struct vmem_altmap *altmap);
 #endif
 
-#ifdef CONFIG_ARCH_WANT_HUGETLB_PAGE_OPTIMIZE_VMEMMA
+#ifdef CONFIG_ARCH_WANT_OPTIMIZE_VMEMMAP
 static inline bool vmemmap_can_optimize(struct vmem_altmap *altmap,
 					   struct dev_pagemap *pgmap)
 {
diff --git a/mm/Kconfig b/mm/Kconfig
index ff7b209dec05..492919cf62a4 100644
--- a/mm/Kconfig
+++ b/mm/Kconfig
@@ -460,6 +460,12 @@  config SPARSEMEM_VMEMMAP
 	  SPARSEMEM_VMEMMAP uses a virtually mapped memmap to optimise
 	  pfn_to_page and page_to_pfn operations.  This is the most
 	  efficient option when sufficient kernel resources are available.
+#
+# Select this config option from the architecture Kconfig, if it is preferred
+# to enable the feature of HugeTLB/dev_dax vmemmap optimization.
+#
+config ARCH_WANT_OPTIMIZE_VMEMMAP
+	bool
 
 config HAVE_MEMBLOCK_PHYS_MAP
 	bool