[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <681fac27-9684-48cd-daec-fb82057f2253@oracle.com>
Date: Wed, 14 Apr 2021 10:07:54 -0700
From: Mike Kravetz <mike.kravetz@...cle.com>
To: Oscar Salvador <osalvador@...e.de>
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 4/13/21 9:52 PM, Oscar Salvador wrote:
> 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.
No strong feelings. I am fine with it as is.
--
Mike Kravetz
Powered by blists - more mailing lists