Re: [External] Re: [PATCH v21 0/9] Free some vmemmap pages of HugeTLB page

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 4/29/21 3:23 PM, Mike Kravetz wrote:
> On 4/28/21 9:02 PM, Muchun Song wrote:
>> On Thu, Apr 29, 2021 at 10:32 AM Mike Kravetz <mike.kravetz@xxxxxxxxxx> wrote:
>>>
>>> On 4/28/21 5:26 AM, Muchun Song wrote:
>>>> On Wed, Apr 28, 2021 at 7:47 AM Mike Kravetz <mike.kravetz@xxxxxxxxxx> wrote:
>>>>>
>>>>> Thanks!  I will take a look at the modifications soon.
>>>>>
>>>>> I applied the patches to Andrew's mmotm-2021-04-21-23-03, ran some tests and
>>>>> got the following warning.  We may need to special case that call to
>>>>> __prep_new_huge_page/free_huge_page_vmemmap from alloc_and_dissolve_huge_page
>>>>> as it is holding hugetlb lock with IRQs disabled.
>>>>
>>>> Good catch. Thanks Mike. I will fix it in the next version. How about this:
>>>>
>>>> @@ -1618,7 +1617,8 @@ static void __prep_new_huge_page(struct hstate
>>>> *h, struct page *page)
>>>>
>>>>  static void prep_new_huge_page(struct hstate *h, struct page *page, int nid)
>>>>  {
>>>> +       free_huge_page_vmemmap(h, page);
>>>>         __prep_new_huge_page(page);
>>>>         spin_lock_irq(&hugetlb_lock);
>>>>         __prep_account_new_huge_page(h, nid);
>>>>         spin_unlock_irq(&hugetlb_lock);
>>>> @@ -2429,6 +2429,7 @@ static int alloc_and_dissolve_huge_page(struct
>>>> hstate *h, struct page *old_page,
>>>>         if (!new_page)
>>>>                 return -ENOMEM;
>>>>
>>>> +       free_huge_page_vmemmap(h, new_page);
>>>>  retry:
>>>>         spin_lock_irq(&hugetlb_lock);
>>>>         if (!PageHuge(old_page)) {
>>>> @@ -2489,7 +2490,7 @@ static int alloc_and_dissolve_huge_page(struct
>>>> hstate *h, struct page *old_page,
>>>>
>>>>  free_new:
>>>>         spin_unlock_irq(&hugetlb_lock);
>>>> -       __free_pages(new_page, huge_page_order(h));
>>>> +       update_and_free_page(h, new_page, false);
>>>>
>>>>         return ret;
>>>>  }
>>>>
>>>>
>>>
>>> Another option would be to leave the prep* routines as is and only
>>> modify alloc_and_dissolve_huge_page as follows:
>>
>> OK. LGTM. I will use this. Thanks Mike.
> 
> There are issues with my suggested patch below.  I am occasionally
> hitting the BUG that checks for page ref count being zero at put_page
> time.  Still do not fully understand, but I do not hit the same BUG
> with your patch above.  Please do not use my patch below.
> 

Ah!  The issue is pretty obvious.


> @@ -2489,7 +2489,7 @@ static int alloc_and_dissolve_huge_page(struct hstate *h, struct page *old_page,
>  
>  free_new:
>  	spin_unlock_irq(&hugetlb_lock);
> -	__free_pages(new_page, huge_page_order(h));
> +	update_and_free_page(h, old_page, false);

That should of course be:
	update_and_free_page(h, new_page, false);

>  
>  	return ret;
>  }
> 

-- 
Mike Kravetz



[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux