Re: [PATCH] mm/page_isolation: fix potential missing call to unset_migratetype_isolate()

From: Miaohe Lin
Date: Mon Sep 06 2021 - 07:42:53 EST


On 2021/9/6 17:46, David Hildenbrand wrote:
> On 06.09.21 11:38, Miaohe Lin wrote:
>> On 2021/9/6 17:27, David Hildenbrand wrote:
>>> On 04.09.21 11:20, Miaohe Lin wrote:
>>>> In start_isolate_page_range() undo path, pfn_to_online_page() just checks
>>>> the first pfn in a pageblock while __first_valid_page() will traverse the
>>>> pageblock until the first online pfn is found. So we may miss the call to
>>>> unset_migratetype_isolate() in undo path and pages will remain isolated
>>>> unexpectedly. Fix this by calling undo_isolate_page_range() and this will
>>>> also help to remove some duplicated codes.
>>>>
>>>> Fixes: 2ce13640b3f4 ("mm: __first_valid_page skip over offline pages")
>>>
>>> While that is true, we shouldn't ever trigger, neither via cma, virtio-mem nor memory offlining, because essentially all operate on MAX_ORDER -1 -aligned ranges without memory holes.
>>
>> I think this should never trigger too. It's a theoretical issue. So is the Fixes tag necessary ?
>>
>
> I think it's one of these "let's add Fixes: but no need for Cc: stable".
>
> BUT in older kernels we could have triggered this via memory offlining eventually ... before c5e79ef561b0 ("mm/memory_hotplug.c: don't allow to online/offline memory blocks with holes") ... so maybe even a Cc: stable?

Looks like it could happen in older kernels. Maybe a Cc: stable is necessary.
Many thanks.

>