[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <5f476e8c-8256-13a8-2228-a2b9e5650586@nvidia.com>
Date: Fri, 30 Jun 2017 16:19:25 -0700
From: Evgeny Baskakov <ebaskakov@...dia.com>
To: Jérôme Glisse <jglisse@...hat.com>,
"akpm@...ux-foundation.org" <akpm@...ux-foundation.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"linux-mm@...ck.org" <linux-mm@...ck.org>
CC: John Hubbard <jhubbard@...dia.com>,
David Nellans <dnellans@...dia.com>,
Mark Hairgrove <mhairgrove@...dia.com>,
Sherry Cheung <SCheung@...dia.com>,
Subhash Gutti <sgutti@...dia.com>
Subject: Re: [HMM 12/15] mm/migrate: new memory migration helper for use with
device memory v4
On 6/26/17 5:07 PM, Evgeny Baskakov wrote:
> Hi Jerome,
>
> The documentation shown above doesn't tell what the alloc_and_copy
callback should do for source pages that have not been allocated yet.
Instead, it unconditionally suggests checking if the MIGRATE_PFN_VALID
and MIGRATE_PFN_MIGRATE flags are set.
>
> Based on my testing and looking in the source code, I see that for
such pages the respective 'src' PFN entries are always set to 0 without
any flags.
>
> The sample driver specifically handles that by checking if there's no
page in the 'src' entry, and ignores any flags in such case:
>
> struct page *spage = migrate_pfn_to_page(*src_pfns);
> ...
> if (spage && !(*src_pfns & MIGRATE_PFN_MIGRATE))
> continue;
>
> if (spage && (*src_pfns & MIGRATE_PFN_DEVICE)) {
>
> I would like to suggest reflecting that in the documentation. Or,
which would be more logical, migrate_vma could keep the zero in the PFN
entries for not allocated pages, but set the MIGRATE_PFN_MIGRATE flag
anyway.
>
> Thanks!
>
> Evgeny Baskakov
> NVIDIA
>
Hi Jerome,
It seems that the kernel can pass 0 in src_pfns for pages that it cannot
migrate (i.e. the kernel knows that they cannot migrate prior to calling
alloc_and_copy).
So, a zero in src_pfns can mean either "the page is not allocated yet"
or "the page cannot migrate".
Can migrate_vma set the MIGRATE_PFN_MIGRATE flag for not allocated
pages? On the driver side it is difficult to differentiate between the
cases.
Thanks!
Evgeny Baskakov
NVIDIA
Powered by blists - more mailing lists