From: Alexey Kardashevskiy <aik@ozlabs.ru>
To: "Aneesh Kumar K.V" <aneesh.kumar@linux.ibm.com>,
akpm@linux-foundation.org, Michal Hocko <mhocko@kernel.org>,
mpe@ellerman.id.au, paulus@samba.org,
David Gibson <david@gibson.dropbear.id.au>
Cc: linux-mm@kvack.org, linuxppc-dev@lists.ozlabs.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH V5 1/3] mm: Add get_user_pages_cma_migrate
Date: Thu, 20 Dec 2018 16:48:30 +1100 [thread overview]
Message-ID: <23cae5a6-4370-224c-523c-ab6ee940cf87@ozlabs.ru> (raw)
In-Reply-To: <b316eb1c-36dc-49e0-f46f-e610f29b6058@linux.ibm.com>
On 20/12/2018 16:22, Aneesh Kumar K.V wrote:
> On 12/20/18 9:49 AM, Alexey Kardashevskiy wrote:
>>
>>
>> On 19/12/2018 14:40, Aneesh Kumar K.V wrote:
>>> This helper does a get_user_pages_fast and if it find pages in the
>>> CMA area
>>> it will try to migrate them before taking page reference. This makes
>>> sure that
>>> we don't keep non-movable pages (due to page reference count) in the
>>> CMA area.
>>> Not able to move pages out of CMA area result in CMA allocation
>>> failures.
>>>
>>> Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.ibm.com>
>>
>
> .....
>>> + * We did migrate all the pages, Try to get the page
>>> references again
>>> + * migrating any new CMA pages which we failed to isolate
>>> earlier.
>>> + */
>>> + drain_allow = true;
>>> + goto get_user_again;
>>
>>
>> So it is possible to have pages pinned, then successfully migrated
>> (migrate_pages() returned 0), then pinned again, then some pages may end
>> up in CMA again and migrate again and nothing seems to prevent this loop
>> from being endless. What do I miss?
>>
>
> pages used as target page for migration won't be allocated from CMA region.
Then migrate_allow should be set to "false" regardless what
migrate_pages() returned and then I am totally missing the point of this
goto and going through the loop again even when we know for sure it
won't do literally anything but checking is_migrate_cma_page() even
though we know pages won't be allocated from CMA.
It should be simple gup_fast() instead of goto and then we won't need
goto/migrate_allow.
--
Alexey
next prev parent reply other threads:[~2018-12-20 5:52 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-12-19 3:40 [PATCH V5 0/3] mm/kvm/vfio/ppc64: Migrate compound pages out of CMA region Aneesh Kumar K.V
2018-12-19 3:40 ` [PATCH V5 1/3] mm: Add get_user_pages_cma_migrate Aneesh Kumar K.V
2018-12-20 4:19 ` Alexey Kardashevskiy
2018-12-20 5:22 ` Aneesh Kumar K.V
2018-12-20 5:48 ` Alexey Kardashevskiy [this message]
2018-12-20 5:52 ` Aneesh Kumar K.V
2018-12-20 6:20 ` Alexey Kardashevskiy
2018-12-20 6:26 ` Aneesh Kumar K.V
2018-12-20 4:28 ` Alexey Kardashevskiy
2018-12-19 3:40 ` [PATCH V5 2/3] powerpc/mm/iommu: Allow migration of cma allocated pages during mm_iommu_get Aneesh Kumar K.V
2018-12-20 5:16 ` Alexey Kardashevskiy
2018-12-19 3:40 ` [PATCH V5 3/3] powerpc/mm/iommu: Allow large IOMMU page size only for hugetlb backing Aneesh Kumar K.V
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=23cae5a6-4370-224c-523c-ab6ee940cf87@ozlabs.ru \
--to=aik@ozlabs.ru \
--cc=akpm@linux-foundation.org \
--cc=aneesh.kumar@linux.ibm.com \
--cc=david@gibson.dropbear.id.au \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=mhocko@kernel.org \
--cc=mpe@ellerman.id.au \
--cc=paulus@samba.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).