Re: [PATCH 2/4] mm/migrate: Defer allocating new page until needed

From: Kirill A. Shutemov
Date: Thu Oct 17 2019 - 07:27:29 EST


On Wed, Oct 16, 2019 at 03:11:51PM -0700, Dave Hansen wrote:
>
> From: Keith Busch <keith.busch@xxxxxxxxx>
>
> Migrating pages had been allocating the new page before it was actually
> needed. Subsequent operations may still fail, which would have to handle
> cleaning up the newly allocated page when it was never used.
>
> Defer allocating the page until we are actually ready to make use of
> it, after locking the original page. This simplifies error handling,
> but should not have any functional change in behavior. This is just
> refactoring page migration so the main part can more easily be reused
> by other code.

Well, the functional change I see is that now we allocate a new page under
page lock of old page.

It *should* be fine, but it has to be call out in the commit message.

--
Kirill A. Shutemov