From: David Hildenbrand <david@redhat.com>
To: linux-mm@kvack.org
Cc: linux-kernel@vger.kernel.org,
David Hildenbrand <david@redhat.com>,
Martin Schwidefsky <schwidefsky@de.ibm.com>,
Heiko Carstens <heiko.carstens@de.ibm.com>,
Vlastimil Babka <vbabka@suse.cz>, Michal Hocko <mhocko@suse.com>,
Andrew Morton <akpm@linux-foundation.org>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
linux-s390@vger.kernel.org
Subject: [PATCH RFCv2 2/4] s390: mm: support removal of memory
Date: Wed, 23 May 2018 20:24:02 +0200 [thread overview]
Message-ID: <20180523182404.11433-3-david@redhat.com> (raw)
In-Reply-To: <20180523182404.11433-1-david@redhat.com>
With virtio-mem, we actually want to remove memory again.
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
Cc: Vlastimil Babka <vbabka@suse.cz>
Cc: Michal Hocko <mhocko@suse.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: linux-s390@vger.kernel.org
Signed-off-by: David Hildenbrand <david@redhat.com>
---
arch/s390/mm/init.c | 18 ++++++++++++------
1 file changed, 12 insertions(+), 6 deletions(-)
diff --git a/arch/s390/mm/init.c b/arch/s390/mm/init.c
index 3fa3e5323612..7202344d0eae 100644
--- a/arch/s390/mm/init.c
+++ b/arch/s390/mm/init.c
@@ -242,12 +242,18 @@ int arch_add_memory(int nid, u64 start, u64 size, struct vmem_altmap *altmap,
#ifdef CONFIG_MEMORY_HOTREMOVE
int arch_remove_memory(u64 start, u64 size, struct vmem_altmap *altmap)
{
- /*
- * There is no hardware or firmware interface which could trigger a
- * hot memory remove on s390. So there is nothing that needs to be
- * implemented.
- */
- return -EBUSY;
+ const unsigned long start_pfn = start >> PAGE_SHIFT;
+ const unsigned long nr_pages = size >> PAGE_SHIFT;
+ struct page *page = pfn_to_page(start_pfn);
+ struct zone *zone;
+ int ret;
+
+ zone = page_zone(page);
+ ret = __remove_pages(zone, start_pfn, nr_pages, altmap);
+ WARN_ON_ONCE(ret);
+ vmem_remove_mapping(start, size);
+
+ return ret;
}
#endif
#endif /* CONFIG_MEMORY_HOTPLUG */
--
2.17.0
next prev parent reply other threads:[~2018-05-23 18:24 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-05-23 18:24 [PATCH RFCv2 0/4] virtio-mem: paravirtualized memory David Hildenbrand
2018-05-23 18:24 ` [PATCH RFCv2 1/4] ACPI: NUMA: export pxm_to_node David Hildenbrand
2018-05-24 8:12 ` Rafael J. Wysocki
2018-05-24 8:33 ` David Hildenbrand
2018-05-24 8:47 ` Rafael J. Wysocki
2018-05-24 8:54 ` David Hildenbrand
2018-05-24 9:01 ` Rafael J. Wysocki
2018-05-24 9:04 ` David Hildenbrand
2018-05-23 18:24 ` David Hildenbrand [this message]
2018-05-23 18:24 ` [PATCH RFCv2 3/4] s390: numa: implement memory_add_physaddr_to_nid() David Hildenbrand
2018-05-23 18:24 ` [PATCH RFCv2 4/4] virtio-mem: paravirtualized memory David Hildenbrand
2018-05-23 18:27 ` [PATCH RFCv2 0/4] " David Hildenbrand
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=20180523182404.11433-3-david@redhat.com \
--to=david@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=gregkh@linuxfoundation.org \
--cc=heiko.carstens@de.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=linux-s390@vger.kernel.org \
--cc=mhocko@suse.com \
--cc=schwidefsky@de.ibm.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).