Re: [PATCH v4 08/10] mm/gup: limit number of gup migration failures, honor failures

From: David Hildenbrand
Date: Fri Dec 18 2020 - 08:06:23 EST



> Am 18.12.2020 um 13:43 schrieb Pavel Tatashin <pasha.tatashin@xxxxxxxxxx>:
>
> On Fri, Dec 18, 2020 at 5:46 AM Michal Hocko <mhocko@xxxxxxxx> wrote:
>>
>> On Thu 17-12-20 13:52:41, Pavel Tatashin wrote:
>> [...]
>>> +#define PINNABLE_MIGRATE_MAX 10
>>> +#define PINNABLE_ISOLATE_MAX 100
>>
>> Why would we need to limit the isolation retries. Those should always be
>> temporary failure unless I am missing something.
>
> Actually, during development, I was retrying isolate errors
> infinitely, but during testing found a hung where when FOLL_TOUCH
> without FOLL_WRITE is passed (fault in kernel without write flag), the
> zero page is faulted. The isolation of the zero page was failing every
> time, therefore the process was hanging.
>
> Since then, I fixed this problem by adding FOLL_WRITE unconditionally
> to FOLL_LONGTERM, but I was worried about other possible bugs that
> would cause hangs, so decided to limit isolation errors. If you think
> it its not necessary, I can unlimit isolate retires.
>
>> I am not sure about the
>> PINNABLE_MIGRATE_MAX either. Why do we want to limit that? migrate_pages
>> already implements its retry logic why do you want to count retries on
>> top of that? I do agree that the existing logic is suboptimal because
>
> True, but again, just recently, I worked on a race bug where pages can
> end up in per-cpu list after lru_add_drain_all() but before isolation,
> so I think retry is necessary.
>
>> the migration failure might be ephemeral or permanent but that should be
>> IMHO addressed at migrate_pages (resp. unmap_and_move) and simply report
>> failures that are permanent - e.g. any potential pre-existing long term
>> pin - if that is possible at all. If not what would cause permanent
>> migration failure? OOM?
>
> Yes, OOM is the main cause for migration failures. And also a few
> cases described in movable zone comment, where it is possible during
> boot some pages can be allocated by memblock in movable zone due to
> lack of memory resources (even if those resources were added later),
> hardware page poisoning is another rare example.
>

How is concurrent migration handled? Like memory offlining, compaction, alloc_contig_range() while trying to pin?


>> --
>> Michal Hocko
>> SUSE Labs
>