[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <7ee1903f-879a-3fca-9abe-7bfafd4118fa@oracle.com>
Date: Mon, 22 Mar 2021 10:01:05 -0700
From: Mike Kravetz <mike.kravetz@...cle.com>
To: Michal Hocko <mhocko@...e.com>
Cc: linux-mm@...ck.org, linux-kernel@...r.kernel.org,
Shakeel Butt <shakeelb@...gle.com>,
Oscar Salvador <osalvador@...e.de>,
David Hildenbrand <david@...hat.com>,
Muchun Song <songmuchun@...edance.com>,
David Rientjes <rientjes@...gle.com>,
Miaohe Lin <linmiaohe@...wei.com>,
Peter Zijlstra <peterz@...radead.org>,
Matthew Wilcox <willy@...radead.org>,
HORIGUCHI NAOYA <naoya.horiguchi@....com>,
"Aneesh Kumar K . V" <aneesh.kumar@...ux.ibm.com>,
Waiman Long <longman@...hat.com>, Peter Xu <peterx@...hat.com>,
Mina Almasry <almasrymina@...gle.com>,
Andrew Morton <akpm@...ux-foundation.org>
Subject: Re: [RFC PATCH 3/8] hugetlb: create remove_hugetlb_page() to separate
functionality
On 3/22/21 7:15 AM, Michal Hocko wrote:
> On Fri 19-03-21 15:42:04, Mike Kravetz wrote:
>> The new remove_hugetlb_page() routine is designed to remove a hugetlb
>> page from hugetlbfs processing. It will remove the page from the active
>> or free list, update global counters and set the compound page
>> destructor to NULL so that PageHuge() will return false for the 'page'.
>> After this call, the 'page' can be treated as a normal compound page or
>> a collection of base size pages.
>>
>> remove_hugetlb_page is to be called with the hugetlb_lock held.
>>
>> Creating this routine and separating functionality is in preparation for
>> restructuring code to reduce lock hold times.
>
> I like this! Counters handling both in __free_huge_page and
> update_and_free_page is really confusing.
>
>
>> Signed-off-by: Mike Kravetz <mike.kravetz@...cle.com>
>> ---
>> mm/hugetlb.c | 70 ++++++++++++++++++++++++++++++++++------------------
>> 1 file changed, 46 insertions(+), 24 deletions(-)
>>
>> diff --git a/mm/hugetlb.c b/mm/hugetlb.c
>> index c537274c2a38..ae185d3315e0 100644
>> --- a/mm/hugetlb.c
>> +++ b/mm/hugetlb.c
>> @@ -1306,6 +1306,46 @@ static inline void destroy_compound_gigantic_page(struct page *page,
>> unsigned int order) { }
>> #endif
>>
>> +/*
>> + * Remove hugetlb page from lists, and update dtor so that page appears
>> + * as just a compound page. A reference is held on the page.
>> + * NOTE: hugetlb specific page flags stored in page->private are not
>> + * automatically cleared. These flags may be used in routines
>> + * which operate on the resulting compound page.
>> + *
>> + * Must be called with hugetlb lock held.
>> + */
>> +static void remove_hugetlb_page(struct hstate *h, struct page *page,
>> + bool adjust_surplus)
>> +{
>> + int nid = page_to_nid(page);
>> +
>
> I think we want lockdep_assert_held here. Lockdep asserts are not used
> in this code but now that you are touching it then it is probably better
> to start adding them. What do you think?
>
Yes, with this type of change we add lockdep tests/qualifiers. They are
lacking in the code, and would be helpful.
I will add them.
--
Mike Kravetz
Powered by blists - more mailing lists