linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Joao Martins <joao.m.martins@oracle.com>
To: Jane Chu <jane.chu@oracle.com>
Cc: Muchun Song <songmuchun@bytedance.com>,
	Dan Williams <dan.j.williams@intel.com>,
	Tarun Sahu <tsahu@linux.ibm.com>,
	linux-mm@kvack.org,
	"Aneesh Kumar K.V" <aneesh.kumar@linux.ibm.com>,
	akpm@linux-foundation.org
Subject: Re: [PATCH] mm/vmemmap/devdax: Fix kernel crash when probing devdax devices
Date: Mon, 10 Apr 2023 18:47:23 +0100	[thread overview]
Message-ID: <ead319d3-5b69-ab19-80b4-8501a257c470@oracle.com> (raw)
In-Reply-To: <ca7a8030-f4e1-1031-da9a-a2910c0e7bc4@oracle.com>



On 10/04/2023 18:27, Jane Chu wrote:
> 
> On 4/8/2023 3:19 AM, Aneesh Kumar K.V wrote:
>> Jane Chu <jane.chu@oracle.com> writes:
>>
>>> On 4/7/2023 5:23 AM, Aneesh Kumar K.V wrote:
>>>> diff --git a/mm/Kconfig b/mm/Kconfig
>>>> index ff7b209dec05..99f87c1be1e8 100644
>>>> --- a/mm/Kconfig
>>>> +++ b/mm/Kconfig
>>>> @@ -461,6 +461,9 @@ config SPARSEMEM_VMEMMAP
>>>>          pfn_to_page and page_to_pfn operations.  This is the most
>>>>          efficient option when sufficient kernel resources are available.
>>>>    +config ARCH_WANT_OPTIMIZE_VMEMMAP
>>>> +    bool
>>>> +
>>>
>>> Could this devdax specific config switch be added to drivers/dax/Kconfig
>>> ? also, how about adding 'DAX' to the config switch name?
>>
>> I would say we want to make it more generic. ie, both hugetlb and devdax
>> can now derive the feature support via ARCH_WANT_OPTIMIZE_VMEMAP
> 
> The two config switches have different purposes, it's better to keep them
> separate.  For example, recent hugetlb high granularity mapping (HGM) project
> requires to users to make a choice between HGM and hugetlb vmemmap
> optimization(at least for now), while one can keep devdax compound page support
> enabled.
> 

Is it done by kconfig? If it helps:

* there's a static key hugetlb can use to tell if this is enabled or not like
how page_fixed_fake_head() uses it:

if (!static_branch_unlikely(&hugetlb_optimize_vmemmap_key))
	...

* there's a hugetlb page bit for that vmemmap optimized pages with
HpageOptimized(page).

* there is a separate hugetlb CONFIG_HUGETLB_PAGE_OPTIMIZE_VMEMMAP which is not
the same as the ARCH kconfig.

But perhaps there's some relevance in the ARCH_HUGETLB specific to HGMv2 that I
am unaware.

>>
>> commit aafb4790ea0250c8d2450e9d23a4be80c663d2ec
>> Author: Aneesh Kumar K.V <aneesh.kumar@linux.ibm.com>
>> Date:   Sat Apr 8 15:41:48 2023 +0530
>>
>>      mm/hugetlb: Remove ARCH_WANT_HUGETLB_PAGE_OPTIMIZE_VMEMMAP
>>           We can depend on the more generic ARCH_WACH_OPTIMIZE_VMEMAP
>>      which is now used to enable both hugetlb and devddax vmemmap optimization.
>>           Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.ibm.com>
>>
>> diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
>> index d3f5945f0aff..77d9713dcd9c 100644
>> --- a/arch/arm64/Kconfig
>> +++ b/arch/arm64/Kconfig
>> @@ -100,7 +100,6 @@ 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
>> diff --git a/arch/loongarch/Kconfig b/arch/loongarch/Kconfig
>> index ce5802066d0e..9cb00f962de1 100644
>> --- a/arch/loongarch/Kconfig
>> +++ b/arch/loongarch/Kconfig
>> @@ -53,7 +53,6 @@ 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
>> diff --git a/arch/s390/Kconfig b/arch/s390/Kconfig
>> index abffccd937b2..df2cd510480a 100644
>> --- a/arch/s390/Kconfig
>> +++ b/arch/s390/Kconfig
>> @@ -126,7 +126,6 @@ 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
>> diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
>> index e8d66d834b4f..5269131cc248 100644
>> --- a/arch/x86/Kconfig
>> +++ b/arch/x86/Kconfig
>> @@ -125,7 +125,6 @@ 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
>> 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/mm/Kconfig b/mm/Kconfig
>> index 99f87c1be1e8..09ac60894763 100644
>> --- a/mm/Kconfig
>> +++ b/mm/Kconfig
>> @@ -460,7 +460,10 @@ 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
>>  
> 
> thanks,
> -jane


  reply	other threads:[~2023-04-10 17:47 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-07 12:23 Aneesh Kumar K.V
2023-04-07 18:03 ` Jane Chu
2023-04-08 10:19   ` Aneesh Kumar K.V
2023-04-10 17:27     ` Jane Chu
2023-04-10 17:47       ` Joao Martins [this message]
2023-04-10 21:39         ` Jane Chu
2023-04-10 22:55           ` Joao Martins
2023-04-09  2:00 ` Dan Williams
2023-04-10 10:33 ` Joao Martins
2023-04-11  8:07   ` Aneesh Kumar K.V
2023-04-11 10:33     ` Joao Martins

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ead319d3-5b69-ab19-80b4-8501a257c470@oracle.com \
    --to=joao.m.martins@oracle.com \
    --cc=akpm@linux-foundation.org \
    --cc=aneesh.kumar@linux.ibm.com \
    --cc=dan.j.williams@intel.com \
    --cc=jane.chu@oracle.com \
    --cc=linux-mm@kvack.org \
    --cc=songmuchun@bytedance.com \
    --cc=tsahu@linux.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox