Messages in this thread | | | From | Muchun Song <> | Date | Mon, 10 May 2021 20:19:47 +0800 | Subject | Re: [External] Re: [PATCH v23 6/9] mm: hugetlb: alloc the vmemmap pages associated with each HugeTLB page |
| |
On Mon, May 10, 2021 at 6:45 PM Oscar Salvador <osalvador@suse.de> wrote: > > On Mon, May 10, 2021 at 11:00:24AM +0800, Muchun Song wrote: > > --- a/mm/hugetlb.c > > +++ b/mm/hugetlb.c > > @@ -1376,6 +1376,39 @@ static void remove_hugetlb_page(struct hstate *h, struct page *page, > > h->nr_huge_pages_node[nid]--; > > } > > > > +static void add_hugetlb_page(struct hstate *h, struct page *page, > > + bool adjust_surplus) > > +{ > > + int zeroed; > > + int nid = page_to_nid(page); > > + > > + VM_BUG_ON_PAGE(!HPageVmemmapOptimized(page), page); > > + > > + lockdep_assert_held(&hugetlb_lock); > > + > > + INIT_LIST_HEAD(&page->lru); > > + h->nr_huge_pages++; > > + h->nr_huge_pages_node[nid]++; > > + > > + if (adjust_surplus) { > > + h->surplus_huge_pages++; > > + h->surplus_huge_pages_node[nid]++; > > + } > > + > > + set_compound_page_dtor(page, HUGETLB_PAGE_DTOR); > > + set_page_private(page, 0); > > I think this has already been discused, so sorry about this. > > The only reason to need the set_page_private() is because of the dissolving > function right? add_hugetlb_page() can only get reached via free_huge_page(), > or dissolve_free_huge_page, and while the former clears the flags, the latter > it does not.
Not exactly right. free_huge_page() does not clear HPageTemporary if the page is temporarily allocated when freeing. You are right that dissolve_free_huge_page() does not clear HPageFreed.
> > I think this function would benefit from some renaming. add_hugetlb_page() gives > me no hint of what is this about, although I can figure it out reading the code.
Because I think it is the reverse operation of remove_hugetlb_page, I named it add_hugetlb_page. Do you have any suggestions for renaming?
Thanks.
> > With that: Reviewed-by: Oscar Salvador <osalvador@suse.de> > > > > > -- > Oscar Salvador > SUSE L3
| |