linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Oscar Salvador <osalvador@suse.de>
To: David Hildenbrand <david@redhat.com>
Cc: Muchun Song <songmuchun@bytedance.com>,
	corbet@lwn.net, akpm@linux-foundation.org, paulmck@kernel.org,
	mike.kravetz@oracle.com, linux-doc@vger.kernel.org,
	linux-kernel@vger.kernel.org, linux-mm@kvack.org,
	duanxiongchun@bytedance.com, smuchun@gmail.com
Subject: Re: [PATCH v2 2/2] mm: memory_hotplug: introduce SECTION_CANNOT_OPTIMIZE_VMEMMAP
Date: Fri, 17 Jun 2022 11:54:21 +0200	[thread overview]
Message-ID: <YqxPTUuqdDpoU9o3@localhost.localdomain> (raw)
In-Reply-To: <186924ab-651f-71a1-93d2-3500a67dffee@redhat.com>

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


  reply	other threads:[~2022-06-17  9:54 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-20  2:55 [PATCH v2 0/2] make hugetlb_optimize_vmemmap compatible with memmap_on_memory Muchun Song
2022-05-20  2:55 ` [PATCH v2 1/2] mm: memory_hotplug: enumerate all supported section flags Muchun Song
2022-06-15  9:35   ` David Hildenbrand
2022-06-15 13:02     ` Muchun Song
2022-05-20  2:55 ` [PATCH v2 2/2] mm: memory_hotplug: introduce SECTION_CANNOT_OPTIMIZE_VMEMMAP Muchun Song
2022-06-15  9:51   ` David Hildenbrand
2022-06-16  2:45     ` Muchun Song
2022-06-16  7:21       ` David Hildenbrand
2022-06-16 10:16         ` Muchun Song
2022-06-16  3:57     ` Oscar Salvador
2022-06-16  7:30       ` David Hildenbrand
2022-06-17  5:46         ` Oscar Salvador
2022-06-17  7:28           ` Muchun Song
2022-06-17  7:39             ` David Hildenbrand
2022-06-17  9:10               ` Muchun Song
2022-06-17  9:25                 ` David Hildenbrand
2022-06-17  9:40                   ` Muchun Song
2022-06-17  9:48             ` Oscar Salvador
2022-06-17  7:43           ` David Hildenbrand
2022-06-17  9:54             ` Oscar Salvador [this message]
2022-06-17 10:14               ` David Hildenbrand
2022-06-17 10:49                 ` Muchun Song
2022-06-17 11:19                   ` Muchun Song
2022-06-18  5:49           ` Muchun Song

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YqxPTUuqdDpoU9o3@localhost.localdomain \
    --to=osalvador@suse.de \
    --cc=akpm@linux-foundation.org \
    --cc=corbet@lwn.net \
    --cc=david@redhat.com \
    --cc=duanxiongchun@bytedance.com \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mike.kravetz@oracle.com \
    --cc=paulmck@kernel.org \
    --cc=smuchun@gmail.com \
    --cc=songmuchun@bytedance.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox