Re: [PATCH 05/10] mm/hugetlb: remove the redundant check on non_swap_entry()

Wei Yang
2020-08-07T14:28:47Z

On Fri, Aug 07, 2020 at 08:55:50PM +0800, Baoquan He wrote:
>On 08/07/20 at 05:12pm, Wei Yang wrote:
>> Migration and hwpoison entry is a subset of non_swap_entry().
>>
>> Remove the redundant check on non_swap_entry().
>>
>> Signed-off-by: Wei Yang <richard.weiyang@linux.alibaba.com>
>
>Hmm, I have posted one patch to do the same thing, got reivewed by
>people.
>
>https://lore.kernel.org/linux-mm/20200723104636.GS32539@MiWiFi-R3L-srv/
>

Nice

>> ---
>> mm/hugetlb.c | 4 ++--
>> 1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/mm/hugetlb.c b/mm/hugetlb.c
>> index d775e514eb2e..f5f04e89000d 100644
>> --- a/mm/hugetlb.c
>> +++ b/mm/hugetlb.c
>> @@ -3778,7 +3778,7 @@ bool is_hugetlb_entry_migration(pte_t pte)
>> if (huge_pte_none(pte) || pte_present(pte))
>> return false;
>> swp = pte_to_swp_entry(pte);
>> - if (non_swap_entry(swp) && is_migration_entry(swp))
>> + if (is_migration_entry(swp))
>> return true;
>> else
>> return false;
>> @@ -3791,7 +3791,7 @@ static int is_hugetlb_entry_hwpoisoned(pte_t pte)
>> if (huge_pte_none(pte) || pte_present(pte))
>> return 0;
>> swp = pte_to_swp_entry(pte);
>> - if (non_swap_entry(swp) && is_hwpoison_entry(swp))
>> + if (is_hwpoison_entry(swp))
>> return 1;
>> else
>> return 0;
>> --
>> 2.20.1 (Apple Git-117)
>>
>>

--
Wei Yang
Help you, Help me