Re: [PATCH 13/16] mm/migration: return errno when isolate_huge_page failed
From: Huang, Ying
Date: Mon Mar 07 2022 - 00:07:38 EST
Miaohe Lin <linmiaohe@xxxxxxxxxx> writes:
> We should return errno (-EBUSY here) when failed to isolate the huge page
> rather than always return 1 which could confuse the user.
>
> Signed-off-by: Miaohe Lin <linmiaohe@xxxxxxxxxx>
> ---
> mm/migrate.c | 6 ++----
> 1 file changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/mm/migrate.c b/mm/migrate.c
> index 6c2dfed2ddb8..279940c0c064 100644
> --- a/mm/migrate.c
> +++ b/mm/migrate.c
> @@ -1618,10 +1618,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;
IMHO, it's better to determine the proper errno inside
isolate_huge_page() instead of in the caller. If you think it's
necessary to get errno here. How about change isolate_huge_page()
instead?
Best Regards,
Huang, Ying
> } else {
> struct page *head;