[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YuuwSoZpRI9kKtLF@nvidia.com>
Date: Thu, 4 Aug 2022 08:40:58 -0300
From: Jason Gunthorpe <jgg@...dia.com>
To: Alistair Popple <apopple@...dia.com>
Cc: linux-mm@...ck.org, akpm@...ux-foundation.org,
linux-kernel@...r.kernel.org,
"Sierra Guiza, Alejandro (Alex)" <alex.sierra@....com>,
Chaitanya Kulkarni <kch@...dia.com>,
Dan Williams <dan.j.williams@...el.com>,
Felix Kuehling <Felix.Kuehling@....com>,
John Hubbard <jhubbard@...dia.com>,
Logan Gunthorpe <logang@...tatee.com>,
Miaohe Lin <linmiaohe@...wei.com>,
Muchun Song <songmuchun@...edance.com>,
Pasha Tatashin <pasha.tatashin@...een.com>,
Ralph Campbell <rcampbell@...dia.com>
Subject: Re: [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@...dia.com>
> Cc: "Sierra Guiza, Alejandro (Alex)" <alex.sierra@....com>
> Cc: Chaitanya Kulkarni <kch@...dia.com>
> Cc: Dan Williams <dan.j.williams@...el.com>
> Cc: Felix Kuehling <Felix.Kuehling@....com>
> Cc: Jason Gunthorpe <jgg@...dia.com>
> Cc: John Hubbard <jhubbard@...dia.com>
> Cc: Logan Gunthorpe <logang@...tatee.com>
> Cc: Miaohe Lin <linmiaohe@...wei.com>
> Cc: Muchun Song <songmuchun@...edance.com>
> Cc: Pasha Tatashin <pasha.tatashin@...een.com>
> Cc: Ralph Campbell <rcampbell@...dia.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
Powered by blists - more mailing lists