Re: [PATCH v3 5/6] mm/gup: migrate pinned pages out of movable zone

From: Michal Hocko
Date: Mon Dec 14 2020 - 09:21:40 EST


On Fri 11-12-20 15:21:39, Pavel Tatashin wrote:
[...]
> diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h
> index b593316bff3d..25c0c13ba4b1 100644
> --- a/include/linux/mmzone.h
> +++ b/include/linux/mmzone.h
> @@ -386,9 +386,14 @@ enum zone_type {
> * likely to succeed, and to locally limit unmovable allocations - e.g.,
> * to increase the number of THP/huge pages. Notable special cases are:
> *
> - * 1. Pinned pages: (long-term) pinning of movable pages might
> - * essentially turn such pages unmovable. Memory offlining might
> - * retry a long time.
> + * 1. Pinned pages: (long-term) pinning of movable pages is avoided
> + * when pages are pinned and faulted, but it is still possible that
> + * address space already has pages in ZONE_MOVABLE at the time when
> + * pages are pinned (i.e. user has touches that memory before
> + * pinning). In such case we try to migrate them to a different zone,
> + * but if migration fails the pages can still end-up pinned in
> + * ZONE_MOVABLE. In such case, memory offlining might retry a long
> + * time and will only succeed once user application unpins pages.

I do agree with others in the thread. This is not really helping out the
current situation much. You should simply fail the pin rather than
pretend all is just fine.
--
Michal Hocko
SUSE Labs