[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <a2f5cb7e-0aaa-cb3c-5437-3aba9ae015d1@redhat.com>
Date: Fri, 17 Jun 2022 12:14:02 +0200
From: David Hildenbrand <david@...hat.com>
To: Oscar Salvador <osalvador@...e.de>
Cc: Muchun Song <songmuchun@...edance.com>, 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 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);
Not sure, though, if that would work with that function.
--
Thanks,
David / dhildenb
Powered by blists - more mailing lists