[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YHZ1A8Wi43DcEv98@localhost.localdomain>
Date: Wed, 14 Apr 2021 06:52:19 +0200
From: Oscar Salvador <osalvador@...e.de>
To: Mike Kravetz <mike.kravetz@...cle.com>
Cc: Andrew Morton <akpm@...ux-foundation.org>,
Vlastimil Babka <vbabka@...e.cz>,
David Hildenbrand <david@...hat.com>,
Michal Hocko <mhocko@...nel.org>,
Muchun Song <songmuchun@...edance.com>, linux-mm@...ck.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH v7 6/7] mm: Make alloc_contig_range handle in-use hugetlb
pages
On Tue, Apr 13, 2021 at 03:48:53PM -0700, Mike Kravetz wrote:
> The label free_new is:
>
> free_new:
> spin_unlock_irq(&hugetlb_lock);
> __free_pages(new_page, huge_page_order(h));
>
> return ret;
>
> So, we are locking and immediately unlocking without any code in
> between. Usually, I don't like like multiple labels before return.
> However, perhaps we should add another to avoid this unnecessary
> cycle. On the other hand, this is an uncommon race condition so the
> simple code may be acceptable.
I guess we could have something like:
free_new:
spin_unlock_irq(&hugetlb_lock);
free_new_nolock:
__free_pages(new_page, huge_page_order(h));
return ret;
And let the retry go to there without locking. But as you said, the
racecondition is rare enough, so I am not sure if this buys us much.
But I can certainly add it if you feel strong about it.
--
Oscar Salvador
SUSE L3
Powered by blists - more mailing lists