Re: [PATCH v2 2/2] mm: remove odd HAVE_PTE_SPECIAL

From: Laurent Dufour
Date: Tue Apr 10 2018 - 12:44:20 EST




On 10/04/2018 17:58, Robin Murphy wrote:
> On 10/04/18 16:25, Laurent Dufour wrote:
>> Remove the additional define HAVE_PTE_SPECIAL and rely directly on
>> CONFIG_ARCH_HAS_PTE_SPECIAL.
>>
>> There is no functional change introduced by this patch
>>
>> Signed-off-by: Laurent Dufour <ldufour@xxxxxxxxxxxxxxxxxx>
>> ---
>> Â mm/memory.c | 23 ++++++++++-------------
>> Â 1 file changed, 10 insertions(+), 13 deletions(-)
>>
>> diff --git a/mm/memory.c b/mm/memory.c
>> index 96910c625daa..53b6344a90d2 100644
>> --- a/mm/memory.c
>> +++ b/mm/memory.c
>> @@ -817,19 +817,13 @@ static void print_bad_pte(struct vm_area_struct *vma,
>> unsigned long addr,
>> ÂÂ * PFNMAP mappings in order to support COWable mappings.
>> ÂÂ *
>> ÂÂ */
>> -#ifdef CONFIG_ARCH_HAS_PTE_SPECIAL
>> -# define HAVE_PTE_SPECIAL 1
>> -#else
>> -# define HAVE_PTE_SPECIAL 0
>> -#endif
>> Â struct page *_vm_normal_page(struct vm_area_struct *vma, unsigned long addr,
>> ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ pte_t pte, bool with_public_device)
>> Â {
>> ÂÂÂÂÂ unsigned long pfn = pte_pfn(pte);
>> Â -ÂÂÂ if (HAVE_PTE_SPECIAL) {
>> -ÂÂÂÂÂÂÂ if (likely(!pte_special(pte)))
>> -ÂÂÂÂÂÂÂÂÂÂÂ goto check_pfn;
>> +#ifdef CONFIG_ARCH_HAS_PTE_SPECIAL
>
> Nit: Couldn't you use IS_ENABLED(CONFIG_ARCH_HAS_PTE_SPECIAL) within the
> existing code structure to avoid having to add these #ifdefs?

I agree, that would be better. I didn't thought about this option..
Thanks for reporting this.