From: "Huang, Ying" <ying.huang@intel.com>
To: Baolin Wang <baolin.wang@linux.alibaba.com>
Cc: <akpm@linux-foundation.org>, <david@redhat.com>,
<ziy@nvidia.com>, <shy828301@gmail.com>,
<jingshan@linux.alibaba.com>, <linux-mm@kvack.org>,
<linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 1/2] mm: gup: Re-pin pages in case of trying several times to migrate
Date: Thu, 20 Oct 2022 16:15:16 +0800 [thread overview]
Message-ID: <87r0z2nc6j.fsf@yhuang6-desk2.ccr.corp.intel.com> (raw)
In-Reply-To: <cc48dc1e4db8c33289f168cf380ab3641f45f8ad.1666251624.git.baolin.wang@linux.alibaba.com> (Baolin Wang's message of "Thu, 20 Oct 2022 15:49:00 +0800")
Baolin Wang <baolin.wang@linux.alibaba.com> writes:
> The migrate_pages() will return the number of {normal page, THP, hugetlb}
> that were not migrated, or an error code. That means it can still return
> the number of failure count, though the pages have been migrated
> successfully with several times re-try.
If my understanding were correct, if pages are migrated successfully
after several times re-tries, the return value will be 0. There's one
possibility for migrate_pages() to return non-zero but all pages are
migrated. That is, when THP is split and all subpages are migrated
successfully.
> So we should not use the return value of migrate_pages() to determin
> if there are pages are failed to migrate. Instead we can validate the
> 'movable_page_list' to see if there are pages remained in the list,
> which are failed to migrate. That can mitigate the failure of longterm
> pinning.
Another choice is to use a special return value for split THP + success
migration. But I'm fine to use list_empty(return_pages).
> Signed-off-by: Baolin Wang <baolin.wang@linux.alibaba.com>
> ---
> mm/gup.c | 7 ++++---
> 1 file changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/mm/gup.c b/mm/gup.c
> index 5182aba..bd8cfcd 100644
> --- a/mm/gup.c
> +++ b/mm/gup.c
> @@ -1914,9 +1914,10 @@ static int migrate_longterm_unpinnable_pages(
> .gfp_mask = GFP_USER | __GFP_NOWARN,
> };
>
> - if (migrate_pages(movable_page_list, alloc_migration_target,
> - NULL, (unsigned long)&mtc, MIGRATE_SYNC,
> - MR_LONGTERM_PIN, NULL)) {
> + ret = migrate_pages(movable_page_list, alloc_migration_target,
> + NULL, (unsigned long)&mtc, MIGRATE_SYNC,
> + MR_LONGTERM_PIN, NULL);
> + if (ret < 0 || !list_empty(movable_page_list)) {
It seems that !list_empty() is sufficient here.
> ret = -ENOMEM;
Why change the error code? I don't think it's a good idea to do that.
> goto err;
> }
Best Regards,
Huang, Ying
next prev parent reply other threads:[~2022-10-20 8:16 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-20 7:49 Baolin Wang
2022-10-20 7:49 ` [PATCH 2/2] mm: migrate: Try again if THP split is failed due to page refcnt Baolin Wang
2022-10-20 8:24 ` Huang, Ying
2022-10-20 9:33 ` Baolin Wang
2022-10-20 19:21 ` Yang Shi
2022-10-21 6:15 ` Baolin Wang
2022-10-20 8:15 ` Huang, Ying [this message]
2022-10-20 9:24 ` [PATCH 1/2] mm: gup: Re-pin pages in case of trying several times to migrate Baolin Wang
2022-10-20 11:43 ` Alistair Popple
2022-10-21 0:28 ` Huang, Ying
2022-10-21 2:51 ` Baolin Wang
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=87r0z2nc6j.fsf@yhuang6-desk2.ccr.corp.intel.com \
--to=ying.huang@intel.com \
--cc=akpm@linux-foundation.org \
--cc=baolin.wang@linux.alibaba.com \
--cc=david@redhat.com \
--cc=jingshan@linux.alibaba.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=shy828301@gmail.com \
--cc=ziy@nvidia.com \
/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