From: Oscar Salvador <osalvador@suse.de>
To: akpm@linux-foundation.org
Cc: david@redhat.com, mhocko@kernel.org,
linux-kernel@vger.kernel.org, linux-mm@kvack.org, vbabka@suse.cz,
pasha.tatashin@soleen.com
Subject: Re: [PATCH 2/5] mm,memory_hotplug: Allocate memmap from the added memory range
Date: Mon, 18 Jan 2021 11:11:48 +0100 [thread overview]
Message-ID: <20210118101148.GB4988@linux> (raw)
In-Reply-To: <20201217130758.11565-3-osalvador@suse.de>
On Thu, Dec 17, 2020 at 02:07:55PM +0100, Oscar Salvador wrote:
> Physical memory hotadd has to allocate a memmap (struct page array) for
> the newly added memory section. Currently, alloc_pages_node() is used
> for those allocations.
>
> This has some disadvantages:
> a) an existing memory is consumed for that purpose
> (eg: ~2MB per 128MB memory section on x86_64)
> b) if the whole node is movable then we have off-node struct pages
> which has performance drawbacks.
> c) It might be there are no PMD_ALIGNED chunks so memmap array gets
> populated with base pages.
>
> This can be improved when CONFIG_SPARSEMEM_VMEMMAP is enabled.
>
> Vmemap page tables can map arbitrary memory.
> That means that we can simply use the beginning of each memory section and
> map struct pages there.
> struct pages which back the allocated space then just need to be treated
> carefully.
>
> Implementation wise we will reuse vmem_altmap infrastructure to override
> the default allocator used by __populate_section_memmap.
> Part of the implementation also relies on memory_block structure gaining
> a new field which specifies the number of vmemmap_pages at the beginning.
> This comes in handy as in {online,offline}_pages, all the isolation and
> migration is being done on (buddy_start_pfn, end_pfn] range,
> being buddy_start_pfn = start_pfn + nr_vmemmap_pages.
>
> In this way, we have:
>
> (start_pfn, buddy_start_pfn - 1] = Initialized and PageReserved
> (buddy_start_pfn, end_pfn] = Initialized and sent to buddy
>
> Hot-remove:
>
> We need to be careful when removing memory, as adding and
> removing memory needs to be done with the same granularity.
> To check that this assumption is not violated, we check the
> memory range we want to remove and if a) any memory block has
> vmemmap pages and b) the range spans more than a single memory
> block, we scream out loud and refuse to proceed.
>
> If all is good and the range was using memmap on memory (aka vmemmap pages),
> we construct an altmap structure so free_hugepage_table does the right
> thing and calls vmem_altmap_free instead of free_pagetable.
>
> Signed-off-by: Oscar Salvador <osalvador@suse.de>
Let us refloat this one before it sinks deeper :-)
--
Oscar Salvador
SUSE L3
next prev parent reply other threads:[~2021-01-18 10:11 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-12-17 13:07 [PATCH 0/5] Allocate memmap from hotadded memory (per device) Oscar Salvador
2020-12-17 13:07 ` [PATCH 1/5] mm: Introduce ARCH_MHP_MEMMAP_ON_MEMORY_ENABLE Oscar Salvador
2021-01-11 16:52 ` David Hildenbrand
2021-01-12 7:26 ` Oscar Salvador
2021-01-12 10:12 ` David Hildenbrand
2021-01-12 11:17 ` Oscar Salvador
2021-01-12 11:17 ` David Hildenbrand
2020-12-17 13:07 ` [PATCH 2/5] mm,memory_hotplug: Allocate memmap from the added memory range Oscar Salvador
2021-01-18 10:11 ` Oscar Salvador [this message]
2021-01-19 13:58 ` David Hildenbrand
2021-01-25 10:39 ` Oscar Salvador
2021-01-25 10:56 ` Oscar Salvador
2021-01-25 11:02 ` David Hildenbrand
2021-01-25 13:36 ` Oscar Salvador
2021-01-25 10:57 ` David Hildenbrand
2021-01-25 11:18 ` Oscar Salvador
2021-01-25 11:23 ` David Hildenbrand
2020-12-17 13:07 ` [PATCH 3/5] acpi,memhotplug: Enable MHP_MEMMAP_ON_MEMORY when supported Oscar Salvador
2021-01-11 16:53 ` David Hildenbrand
2020-12-17 13:07 ` [PATCH 4/5] powerpc/memhotplug: " Oscar Salvador
2021-01-11 16:55 ` David Hildenbrand
2021-01-12 13:31 ` Oscar Salvador
2020-12-17 13:07 ` [PATCH 5/5] mm,memory_hotplug: Add kernel boot option to enable memmap_on_memory Oscar Salvador
2021-01-11 9:05 ` [PATCH 0/5] Allocate memmap from hotadded memory (per device) Oscar Salvador
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=20210118101148.GB4988@linux \
--to=osalvador@suse.de \
--cc=akpm@linux-foundation.org \
--cc=david@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mhocko@kernel.org \
--cc=pasha.tatashin@soleen.com \
--cc=vbabka@suse.cz \
/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;
as well as URLs for NNTP newsgroup(s).