lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YqxPTUuqdDpoU9o3@localhost.localdomain>
Date:   Fri, 17 Jun 2022 11:54:21 +0200
From:   Oscar Salvador <osalvador@...e.de>
To:     David Hildenbrand <david@...hat.com>
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 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]

we only mark as VmemmapSelfHosted the memmap pages.

head page points to [normal pages] range, that is why we need to go
and get its mem_map to see whether those pages are marked.

Does it make sense? Or am I missing something?
         

> > +
> > +	if (PageVmemmap_self_hosted(memmap))
> 
> Maybe that's the right place for a comment, an ascii art, and how it is
> safe to only check the first vmemmap page due to alignment restrictions.

Yes, definitely worth putting in a comment.

  
> > +	/*
> > +	 * Let us flag self-hosted memmap
> > +	 */
> 
> I think that comment can be dropped because the code does exactly that.

Yeah, was mainly to picture it, but it needs to go as it is worthless.


-- 
Oscar Salvador
SUSE Labs

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ