From: Pasha Tatashin <Pavel.Tatashin@microsoft.com>
To: Oscar Salvador <osalvador@techadventures.net>,
"akpm@linux-foundation.org" <akpm@linux-foundation.org>
Cc: "mhocko@suse.com" <mhocko@suse.com>,
"dan.j.williams@intel.com" <dan.j.williams@intel.com>,
"jglisse@redhat.com" <jglisse@redhat.com>,
"david@redhat.com" <david@redhat.com>,
"jonathan.cameron@huawei.com" <jonathan.cameron@huawei.com>,
"yasu.isimatu@gmail.com" <yasu.isimatu@gmail.com>,
"logang@deltatee.com" <logang@deltatee.com>,
"dave.jiang@intel.com" <dave.jiang@intel.com>,
"linux-mm@kvack.org" <linux-mm@kvack.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
Oscar Salvador <osalvador@suse.de>
Subject: Re: [RFC v2 2/2] mm/memory_hotplug: Shrink spanned pages when offlining memory
Date: Wed, 29 Aug 2018 23:09:01 +0000 [thread overview]
Message-ID: <348c662b-455a-1ea4-1db5-3bddcbdb4f14@microsoft.com> (raw)
In-Reply-To: <20180817154127.28602-3-osalvador@techadventures.net>
On 8/17/18 11:41 AM, Oscar Salvador wrote:
> From: Oscar Salvador <osalvador@suse.de>
>
> Currently, we decrement zone/node spanned_pages when we
> remove memory and not when we offline it.
>
> This, besides of not being consistent with the current code,
> implies that we can access steal pages if we never get to online
> that memory.
>
> In order to prevent that, we have to move all zone/pages stuff to
> the offlining memory stage.
> Removing memory path should only care about memory sections and memory
> blocks.
>
> Another thing to notice here is that this is not so easy to be done
> as HMM/devm have a particular handling of memory-hotplug.
> They do not go through the common path, and so, they do not
> call either offline_pages() nor online_pages().
>
> All they care about is to add the sections, move the pages to
> ZONE_DEVICE, and in some cases, to create the linear mapping.
>
> In order to do this more smooth, two new functions are created
> to deal with these particular cases:
>
> del_device_memory
> add_device_memory
>
> add_device_memory is in charge of
>
> a) calling either arch_add_memory() or add_pages(), depending on whether
> we want a linear mapping
> b) online the memory sections that correspond to the pfn range
> c) calling move_pfn_range_to_zone() being zone ZONE_DEVICE to
> expand zone/pgdat spanned pages and initialize its pages
>
> del_device_memory, on the other hand, is in charge of
>
> a) offline the memory sections that correspond to the pfn range
> b) calling shrink_pages(), which shrinks node/zone spanned pages.
> c) calling either arch_remove_memory() or __remove_pages(), depending on
> whether we need to tear down the linear mapping or not
>
> These two functions are called from:
>
> add_device_memory:
> - devm_memremap_pages()
> - hmm_devmem_pages_create()
>
> del_device_memory:
> - devm_memremap_pages_release()
> - hmm_devmem_release()
>
> I think that this will get easier as soon as [1] gets merged.
>
> Finally, shrink_pages() is moved to offline_pages(), so now,
> all pages/zone handling is being taken care in online/offline_pages stage.
>
> [1] https://lkml.org/lkml/2018/6/19/110
>
> Signed-off-by: Oscar Salvador <osalvador@suse.de>
> ---
> arch/ia64/mm/init.c | 4 +-
> arch/powerpc/mm/mem.c | 10 +--
> arch/sh/mm/init.c | 4 +-
> arch/x86/mm/init_32.c | 4 +-
> arch/x86/mm/init_64.c | 8 +--
> include/linux/memory_hotplug.h | 9 ++-
> kernel/memremap.c | 14 ++--
> kernel/resource.c | 16 +++++
> mm/hmm.c | 32 ++++-----
> mm/memory_hotplug.c | 143 +++++++++++++++++++++++++++--------------
> mm/sparse.c | 4 +-
> 11 files changed, 145 insertions(+), 103 deletions(-)
Hi Oscar,
I have been studying this patch, and do not see anything bad about it
except that it begs to be split into smaller patches. I think you can
send this work as a series without RFC if this patch is split into 3 or
so patches. I will review that series.
Thank you,
Pavel
next prev parent reply other threads:[~2018-08-29 23:09 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-08-17 15:41 [RFC v2 0/2] Do not touch pages in remove_memory path Oscar Salvador
2018-08-17 15:41 ` [RFC v2 1/2] mm/memory_hotplug: Add nid parameter to arch_remove_memory Oscar Salvador
2018-08-17 15:41 ` [RFC v2 2/2] mm/memory_hotplug: Shrink spanned pages when offlining memory Oscar Salvador
2018-08-21 13:17 ` David Hildenbrand
2018-08-22 7:50 ` Oscar Salvador
2018-08-22 8:11 ` David Hildenbrand
2018-08-29 23:09 ` Pasha Tatashin [this message]
2018-08-31 20:50 ` Oscar Salvador
2018-08-28 11:47 ` [RFC v2 0/2] Do not touch pages in remove_memory path Oscar Salvador
2018-08-29 17:04 ` Jerome Glisse
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=348c662b-455a-1ea4-1db5-3bddcbdb4f14@microsoft.com \
--to=pavel.tatashin@microsoft.com \
--cc=akpm@linux-foundation.org \
--cc=dan.j.williams@intel.com \
--cc=dave.jiang@intel.com \
--cc=david@redhat.com \
--cc=jglisse@redhat.com \
--cc=jonathan.cameron@huawei.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=logang@deltatee.com \
--cc=mhocko@suse.com \
--cc=osalvador@suse.de \
--cc=osalvador@techadventures.net \
--cc=yasu.isimatu@gmail.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