Re: [PATCH v2 2/2] mm: memory_hotplug: introduce SECTION_CANNOT_OPTIMIZE_VMEMMAP

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

 



On Fri, Jun 17, 2022 at 06:49:15PM +0800, Muchun Song wrote:
> On Fri, Jun 17, 2022 at 12:14:02PM +0200, David Hildenbrand wrote:
> > On 17.06.22 11:54, Oscar Salvador wrote:
> > > On Fri, Jun 17, 2022 at 09:43:33AM +0200, David Hildenbrand wrote:
> > >> VmemmapSelfHosted, then the function names get nicer.
> > > 
> > > Definitely.
> > > 
> > >>
> > >>> +#endif
> > >>> +
> > >>>  /*
> > >>>   * On an anonymous page mapped into a user virtual memory area,
> > >>>   * page->mapping points to its anon_vma, not to a struct address_space;
> > >>> diff --git a/mm/hugetlb_vmemmap.c b/mm/hugetlb_vmemmap.c
> > >>> index 1089ea8a9c98..e2de7ed27e9e 100644
> > >>> --- a/mm/hugetlb_vmemmap.c
> > >>> +++ b/mm/hugetlb_vmemmap.c
> > >>> @@ -101,6 +101,14 @@ void hugetlb_vmemmap_free(struct hstate *h, struct page *head)
> > >>>  {
> > >>>  	unsigned long vmemmap_addr = (unsigned long)head;
> > >>>  	unsigned long vmemmap_end, vmemmap_reuse, vmemmap_pages;
> > >>> +	struct mem_section *ms = __pfn_to_section(page_to_pfn(head));
> > >>> +	struct page *memmap;
> > >>> +
> > >>> +	memmap = sparse_decode_mem_map(ms->section_mem_map,
> > >>> +				       pfn_to_section_nr(page_to_pfn(head)));
> > >>
> > >> Why can't we check the head page directly? Either I need more coffee or
> > >> this can be simplified.
> > > 
> > > Uhm, maybe I'm the one who needs coffe here but we have something like:
> > > 
> > > [    hot-plugges section   ]
> > > [memmap pages][normal pages]
> > 
> > Oh, right, we need the memmap for our hugetlb page (which resides in the
> > reserved section), but these are not marked. We need the memmap of that
> > memmap.
> > 
> > I assume one could directly via the page address. Because we want the
> > memmap of the memmap.
> > 
> > vmmemmap_page = virt_to_page(head);
> >
>
> I think this can works, more simple.
> 

Oh, I forgot virt_to_page() cannot applicable for vmemmap addresses.
I think Oscar's approach is right.

> Thanks.
>  
> > Not sure, though, if that would work with that function.
> 




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux