[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YqxcK/XzyNn+KfGt@FVFYT0MHHV2J.usts.net>
Date: Fri, 17 Jun 2022 18:49:15 +0800
From: Muchun Song <songmuchun@...edance.com>
To: David Hildenbrand <david@...hat.com>
Cc: Oscar Salvador <osalvador@...e.de>, corbet@....net,
akpm@...ux-foundation.org, paulmck@...nel.org,
mike.kravetz@...cle.com, linux-doc@...r.kernel.org,
linux-kernel@...r.kernel.org, linux-mm@...ck.org,
duanxiongchun@...edance.com, smuchun@...il.com
Subject: Re: [PATCH v2 2/2] mm: memory_hotplug: introduce
SECTION_CANNOT_OPTIMIZE_VMEMMAP
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.
Thanks.
> Not sure, though, if that would work with that function.
Powered by blists - more mailing lists