lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <8735jsgctq.fsf@yhuang6-desk2.ccr.corp.intel.com>
Date:   Wed, 09 Mar 2022 09:00:01 +0800
From:   "Huang, Ying" <ying.huang@...el.com>
To:     Miaohe Lin <linmiaohe@...wei.com>
Cc:     <akpm@...ux-foundation.org>, <mike.kravetz@...cle.com>,
        <shy828301@...il.com>, <willy@...radead.org>, <ziy@...dia.com>,
        <minchan@...nel.org>, <apopple@...dia.com>,
        <ave.hansen@...ux.intel.com>, <o451686892@...il.com>,
        <almasrymina@...gle.com>, <jhubbard@...dia.com>,
        <rcampbell@...dia.com>, <peterx@...hat.com>,
        <naoya.horiguchi@....com>, <mhocko@...e.com>, <riel@...hat.com>,
        <linux-mm@...ck.org>, <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 13/16] mm/migration: return errno when isolate_huge_page
 failed

Miaohe Lin <linmiaohe@...wei.com> writes:

> On 2022/3/7 13:07, Huang, Ying wrote:
>> Miaohe Lin <linmiaohe@...wei.com> 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@...wei.com>
>>> ---
>>>  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?
>
> IMO, -EBUSY should be enough for the user (as they could not do much) and this
> errno keeps consistent with the non-hugetlb page case. What do you think?

I found the prototype of isolate_lru_page() is as follows,

  int isolate_lru_page(struct page *page)

And it will return errno directly.  I think we should follow same
convention here?

Best Regards,
Huang, Ying

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ