lkml.org 
[lkml]   [2022]   [Aug]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] mm/gup.c: Refactor check_and_migrate_movable_pages()
On Thu, Aug 04, 2022 at 01:22:41PM +1000, Alistair Popple wrote:
> When pinning pages with FOLL_LONGTERM check_and_migrate_movable_pages()
> is called to migrate pages out of zones which should not contain any
> longterm pinned pages.
>
> When migration succeeds all pages will have been unpinned so pinning
> needs to be retried. Migration can also fail, in which case the pages
> will also have been unpinned but the operation should not be retried. If
> all pages are in the correct zone nothing will be unpinned and no retry
> is required.
>
> The logic in check_and_migrate_movable_pages() tracks unnecessary state
> and the return codes for each case are difficult to follow. Refactor the
> code to clean this up. No behaviour change is intended.
>
> Signed-off-by: Alistair Popple <apopple@nvidia.com>
> Cc: "Sierra Guiza, Alejandro (Alex)" <alex.sierra@amd.com>
> Cc: Chaitanya Kulkarni <kch@nvidia.com>
> Cc: Dan Williams <dan.j.williams@intel.com>
> Cc: Felix Kuehling <Felix.Kuehling@amd.com>
> Cc: Jason Gunthorpe <jgg@nvidia.com>
> Cc: John Hubbard <jhubbard@nvidia.com>
> Cc: Logan Gunthorpe <logang@deltatee.com>
> Cc: Miaohe Lin <linmiaohe@huawei.com>
> Cc: Muchun Song <songmuchun@bytedance.com>
> Cc: Pasha Tatashin <pasha.tatashin@soleen.com>
> Cc: Ralph Campbell <rcampbell@nvidia.com>
>
> ---
>
> Originally posted as "mm/gup.c: Simplify and fix
> check_and_migrate_movable_pages() return codes"[1].
>
> Changes from that version:
>
> - Restore the original isolation failure behaviour and don't fail the
> pup. Instead retry indefinitely.
> - Unpin all pages on retry or failure rather than just failure.
>
> Jason - I dropped your Reviewed-by. I had to remove the changes to make
> error handling follow convention as we need to always unpin the pages.
> We also need the list_empty() checks because we may or may not have
> pages in the list if we found coherent pages. So there isn't much I
> could see to simplify, but let me know if you spot some.

I don't quite understand this, if the point is to loop on the LRU
indefinately, why not just code that? Why do we need to go around the
big loop?

Jason

\
 
 \ /
  Last update: 2022-08-04 13:42    [W:0.071 / U:0.188 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site