lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <87v8r75ssf.fsf@nvdebian.thelocal>
Date:   Fri, 05 Aug 2022 11:56:58 +1000
From:   Alistair Popple <apopple@...dia.com>
To:     Jason Gunthorpe <jgg@...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()


Jason Gunthorpe <jgg@...dia.com> writes:

> 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?

I assume by "big loop" you mean calling
check_and_migrate_movable_pages() again? We have to do that after the
migration anyway. Looping on the LRU indefinitely inside
check_and_migrate_movable_pages() doesn't remove that requirement so I'm
not convinced it would simplify things much.

It could also lead to deadlock because we may already have other pages
isolated from the LRU.

 - Alistair

> Jason

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ