linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@infradead.org>
To: Miaohe Lin <linmiaohe@huawei.com>
Cc: akpm@linux-foundation.org, mike.kravetz@oracle.com,
	shy828301@gmail.com, willy@infradead.org, ying.huang@intel.com,
	ziy@nvidia.com, minchan@kernel.org, apopple@nvidia.com,
	dave.hansen@linux.intel.com, o451686892@gmail.com,
	jhubbard@nvidia.com, peterx@redhat.com, naoya.horiguchi@nec.com,
	mhocko@suse.com, riel@redhat.com, osalvador@suse.de,
	david@redhat.com, sfr@canb.auug.org.au, linux-mm@kvack.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 3/4] mm/migration: return errno when isolate_huge_page failed
Date: Mon, 11 Apr 2022 07:10:50 -0700	[thread overview]
Message-ID: <YlQ26kP8zpCLWqwW@infradead.org> (raw)
In-Reply-To: <20220409073846.22286-4-linmiaohe@huawei.com>

On Sat, Apr 09, 2022 at 03:38:45PM +0800, Miaohe Lin wrote:
> We might fail to isolate huge page due to e.g. the page is under migration
> which cleared HPageMigratable. So we should return -EBUSY in this case
> rather than always return 1 which could confuse the user.
> 
> Fixes: e8db67eb0ded ("mm: migrate: move_pages() supports thp migration")
> Reviewed-by: Muchun Song <songmuchun@bytedance.com>
> Reviewed-by: Baolin Wang <baolin.wang@linux.alibaba.com>
> Signed-off-by: Miaohe Lin <linmiaohe@huawei.com>
> ---
>  mm/migrate.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/mm/migrate.c b/mm/migrate.c
> index 381963231a62..044656a14ae2 100644
> --- a/mm/migrate.c
> +++ b/mm/migrate.c
> @@ -1632,10 +1632,8 @@ static int add_page_for_migration(struct mm_struct *mm, unsigned long addr,
>  		goto out_putpage;
>  
>  	if (PageHuge(page)) {
> -		if (PageHead(page)) {
> -			isolate_huge_page(page, pagelist);
> -			err = 1;
> -		}
> +		if (PageHead(page))
> +			err = isolate_huge_page(page, pagelist) ? 1 : -EBUSY;

I think a:

			err = isolate_huge_page(page, pagelist);
			if (!err)
				err = 1;

would be a lot more readable here.



  reply	other threads:[~2022-04-11 14:11 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-09  7:38 [PATCH 0/4] A few cleanup and fixup patches for migration Miaohe Lin
2022-04-09  7:38 ` [PATCH 1/4] mm/migration: reduce the rcu lock duration Miaohe Lin
2022-04-11 14:09   ` Christoph Hellwig
2022-04-12  2:07   ` ying.huang
2022-04-12  3:21     ` Miaohe Lin
2022-04-09  7:38 ` [PATCH 2/4] mm/migration: remove unneeded lock page and PageMovable check Miaohe Lin
2022-04-11 14:09   ` Christoph Hellwig
2022-04-09  7:38 ` [PATCH 3/4] mm/migration: return errno when isolate_huge_page failed Miaohe Lin
2022-04-11 14:10   ` Christoph Hellwig [this message]
2022-04-12  3:13     ` Miaohe Lin
2022-04-09  7:38 ` [PATCH 4/4] mm/migration: fix potential pte_unmap on an not mapped pte Miaohe Lin
2022-04-09 11:38   ` kernel test robot
2022-04-11  1:54     ` Miaohe Lin
2022-04-11 11:41   ` David Hildenbrand
2022-04-12  2:55     ` Miaohe Lin
2022-04-12  2:25 ` [PATCH 0/4] A few cleanup and fixup patches for migration ying.huang
2022-04-12  3:29   ` Miaohe Lin
2022-04-12  6:33     ` ying.huang
2022-04-12  8:59       ` Miaohe Lin
2022-04-12  7:00     ` ying.huang
2022-04-12  9:06       ` Miaohe Lin

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=YlQ26kP8zpCLWqwW@infradead.org \
    --to=hch@infradead.org \
    --cc=akpm@linux-foundation.org \
    --cc=apopple@nvidia.com \
    --cc=dave.hansen@linux.intel.com \
    --cc=david@redhat.com \
    --cc=jhubbard@nvidia.com \
    --cc=linmiaohe@huawei.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mhocko@suse.com \
    --cc=mike.kravetz@oracle.com \
    --cc=minchan@kernel.org \
    --cc=naoya.horiguchi@nec.com \
    --cc=o451686892@gmail.com \
    --cc=osalvador@suse.de \
    --cc=peterx@redhat.com \
    --cc=riel@redhat.com \
    --cc=sfr@canb.auug.org.au \
    --cc=shy828301@gmail.com \
    --cc=willy@infradead.org \
    --cc=ying.huang@intel.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;
as well as URLs for NNTP newsgroup(s).