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: <Yvt/hZYfSvlCbU02@nvidia.com>
Date:   Tue, 16 Aug 2022 08:29:09 -0300
From:   Jason Gunthorpe <jgg@...dia.com>
To:     Alistair Popple <apopple@...dia.com>
Cc:     linux-mm@...ck.org, akpm@...ux-foundation.org,
        linux-kernel@...r.kernel.org,
        "Sierra Guiza, Alejandro (Alex)" <alex.sierra@....com>,
        Chaitanya Kulkarni <kch@...dia.com>,
        Dan Williams <dan.j.williams@...el.com>,
        Felix Kuehling <Felix.Kuehling@....com>,
        John Hubbard <jhubbard@...dia.com>,
        Logan Gunthorpe <logang@...tatee.com>,
        Miaohe Lin <linmiaohe@...wei.com>,
        Muchun Song <songmuchun@...edance.com>,
        Ralph Campbell <rcampbell@...dia.com>,
        David Hildenbrand <david@...hat.com>,
        Matthew Wilcox <willy@...radead.org>
Subject: Re: [PATCH v4 2/2] mm/gup.c: Refactor
 check_and_migrate_movable_pages()

On Tue, Aug 16, 2022 at 03:29:20PM +1000, Alistair Popple wrote:

> >> +static long check_and_migrate_movable_pages(unsigned long nr_pages,
> >> +					    struct page **pages)
> >> +{
> >> +	int ret;
> >> +	unsigned long collected;
> >> +	LIST_HEAD(movable_page_list);
> >> +
> >> +	collected = collect_longterm_unpinnable_pages(&movable_page_list, nr_pages, pages);
> >> +	if (!collected)
> >> +		return 0;
> >> +
> >> +	ret = migrate_longterm_unpinnable_pages(&movable_page_list, nr_pages, pages);
> >> +	if (!ret)
> >> +		return -EAGAIN;
> >> +	else
> >> +		return ret;
> >
> > I would drop the else path and just return zero
> 
> Unless I've misunderstood you I don't think that's correct though.
> check_and_migrate_movable_pages() needs to return one of 3 conditions:
> 
>  - 0: All pages are in the correct zone and are still pinned (ie. "success").
>  - -EAGAIN: Some pages were migrated, all pages need re-pinning.
>  - errno: Migration failed, pins were dropped and PUP should fail.
> 
> John's suggested comment update spells this out more clearly.

But that is not what it does..

if (!ret) == if (ret != 0)
        return -EAGAIN
thus ret == 0
return ret == return 0

Jason

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ