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]
Date:   Thu, 18 Mar 2021 11:12:28 +0100
From:   Michal Hocko <mhocko@...e.com>
To:     Oscar Salvador <osalvador@...e.de>
Cc:     Andrew Morton <akpm@...ux-foundation.org>,
        Vlastimil Babka <vbabka@...e.cz>,
        David Hildenbrand <david@...hat.com>,
        Muchun Song <songmuchun@...edance.com>,
        Mike Kravetz <mike.kravetz@...cle.com>, linux-mm@...ck.org,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH v5 4/5] mm: Make alloc_contig_range handle in-use hugetlb
 pages

On Thu 18-03-21 10:59:10, Oscar Salvador wrote:
> On Thu, Mar 18, 2021 at 10:29:57AM +0100, Michal Hocko wrote:
> > On Thu 18-03-21 09:54:01, Oscar Salvador wrote:
> > [...]
> > > @@ -2287,10 +2288,12 @@ static int alloc_and_dissolve_huge_page(struct hstate *h, struct page *old_page)
> > >  		goto unlock;
> > >  	} else if (page_count(old_page)) {
> > >  		/*
> > > -		 * Someone has grabbed the page, fail for now.
> > > +		 * Someone has grabbed the page, try to isolate it here.
> > > +		 * Fail with -EBUSY if not possible.
> > >  		 */
> > > -		ret = -EBUSY;
> > >  		update_and_free_page(h, new_page);
> > > +		if (!isolate_huge_page(old_page, list)
> > > +			ret = -EBUSY;
> > >  		goto unlock;
> > >  	} else if (!HPageFreed(old_page)) {
> > 
> > I do not think you want to call isolate_huge_page with hugetlb_lock
> > held. You would need to drop the lock before calling isolate_huge_page.
> 
> Yeah, that was an oversight. As I said I did not compile it(let alone
> test it), otherwise the system would have screamed I guess.
> 
> I was more interested in knowing whether how did it look wrt. retry
> concerns:

Yes this looks much more to my taste. If we need to retry then it could
just goto retry there. The caller doesn't really have to care.

> @@ -2287,10 +2288,14 @@ static int alloc_and_dissolve_huge_page(struct hstate *h, struct page *old_page)
>  		goto unlock;
>  	} else if (page_count(old_page)) {
>  		/*
> -		 * Someone has grabbed the page, fail for now.
> +		 * Someone has grabbed the page, try to isolate it here.
> +		 * Fail with -EBUSY if not possible.
>  		 */
> -		ret = -EBUSY;
>  		update_and_free_page(h, new_page);
> +		spin_unlock(&hugetlb_lock);
> +		if (!isolate_huge_page(old_page, list)
> +			ret = -EBUSY;
> +		spin_lock(&hugetlb_lock);
>  		goto unlock;

simply return ret; here
-- 
Michal Hocko
SUSE Labs

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ