[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YHf5bW9GTxeSwfZN@localhost.localdomain>
Date: Thu, 15 Apr 2021 10:29:33 +0200
From: Oscar Salvador <osalvador@...e.de>
To: Michal Hocko <mhocko@...e.com>
Cc: Andrew Morton <akpm@...ux-foundation.org>,
Mike Kravetz <mike.kravetz@...cle.com>,
Vlastimil Babka <vbabka@...e.cz>,
David Hildenbrand <david@...hat.com>,
Muchun Song <songmuchun@...edance.com>, linux-mm@...ck.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH v7 5/7] mm: Make alloc_contig_range handle free hugetlb
pages
On Tue, Apr 13, 2021 at 03:40:18PM +0200, Michal Hocko wrote:
> > + /*
> > + * Call __prep_new_huge_page() to construct the hugetlb page, and
> > + * enqueue it then to place it in the freelists. After this,
> > + * counters are back on track. Free hugepages have a refcount of 0,
> > + * so we need to decrease new_page's count as well.
> > + */
> > + __prep_new_huge_page(new_page);
> > + __prep_account_new_huge_page(h, nid);
>
> I think it would help to put something like the following into the
> comment above this really strange construct.
>
> /*
> * new_page needs to be initialized with the standard
> * hugetlb state. This is normally done by
> * prep_new_huge_page but that takes hugetlb_lock which
> * is already held so we need to open code it here.
> * Reference count trick is needed because allocator
> * gives us referenced page but the pool requires pages
> * with 0 refcount.
> */
Ok, I will try to add more info, thanks Michal!
--
Oscar Salvador
SUSE L3
Powered by blists - more mailing lists