From patchwork Wed May 23 18:24:02 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Hildenbrand X-Patchwork-Id: 10422023 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 7B0CC60224 for ; Wed, 23 May 2018 18:24:23 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6C0982910F for ; Wed, 23 May 2018 18:24:23 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 60E1329126; Wed, 23 May 2018 18:24:23 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00, MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D2C8C2910F for ; Wed, 23 May 2018 18:24:22 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 624FB6B000A; Wed, 23 May 2018 14:24:19 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 53D0D6B000C; Wed, 23 May 2018 14:24:19 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 2F0E66B000D; Wed, 23 May 2018 14:24:19 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-qk0-f197.google.com (mail-qk0-f197.google.com [209.85.220.197]) by kanga.kvack.org (Postfix) with ESMTP id F35DB6B000A for ; Wed, 23 May 2018 14:24:18 -0400 (EDT) Received: by mail-qk0-f197.google.com with SMTP id d71-v6so6738772qkg.0 for ; Wed, 23 May 2018 11:24:18 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-original-authentication-results:x-gm-message-state:from:to:cc :subject:date:message-id:in-reply-to:references; bh=47Nhj412fyl/hg8GWq0ps6rxaw9fjmOhSMQGQwR3sjU=; b=nKb3lLVdP271SdkryftjsxYw4iR4xgxJ5ryupF3cPwy1NFKkHyCfDDAHemwBkJPuS7 Ug31/BoDXWTroBBU6yyrf2I4uWbdf8h8jOIPNYUxppjhlvWo6GPUUBv9j9QgsAy3M/JE CySxGB+Ywd9AQzyNCwVjvEsbIYaXb6MH1yhNFh6LuEB4bPwJvSMINGj9eGPO8YfZMtf7 8sJ8cvneMEsCkFhRul62UbgJFJXFHwv4lzy8nD44EQ9tk9Z+Rfi2R6sgiCAQ1Axnm/rp 725t3gyVjp8B+tFJA6ImEUseZqE3l0Lxe4kjmQ3QJMawu8S2dOI9uRbPlYicJOzO1PPn UD1A== X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of david@redhat.com designates 66.187.233.73 as permitted sender) smtp.mailfrom=david@redhat.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com X-Gm-Message-State: ALKqPwc/T4GCTfSi5NP232MqWEsJkyWwgW8ZNDp4MmDqbvi9sfYr+Cw/ VHK54GhzeJA5thC0sqA+pWtGK6hGzeeQ+xeKPLlRckHKsV2Ab7YyJC4IUiKD6bOQQ0fFPu5sJsn yTKZrLVN3M0wQF+JlKqhvC5DBWjOaymtUhNGTsgB3TW9eeY7GrT9ef4n2tvyTn59Pbg== X-Received: by 2002:aed:25a2:: with SMTP id x31-v6mr3846841qtc.305.1527099858775; Wed, 23 May 2018 11:24:18 -0700 (PDT) X-Google-Smtp-Source: ADUXVKKPbhvwrszQLI/+5O3ipUa9GZrrVqwkl7cH8WpEEZhy8ODgyw2mXmch4rNVYWdFOWbc4ofw X-Received: by 2002:aed:25a2:: with SMTP id x31-v6mr3846811qtc.305.1527099858262; Wed, 23 May 2018 11:24:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527099858; cv=none; d=google.com; s=arc-20160816; b=rZiqaWOG7jcQkmXdKT3nyQKDe8vqnejzydMDVZ0Y1TLsqwkTZEd7RrZ1ul0PV49HHX Aj77idQPVnEHUN/hsgOAU5vRK3UW8OgRBmbhD2POkn55j4FYDjxNtmLc5JkiA6yi1jBo caHMA5rwCOhw2As21xR9RLCQPqvzL67nF9hRYlOTI7XNQVeJpssiuUhudw9p5SbzZW5A +EvXzKfdaVzpCX0//arecQJF99kWi6Nwsm0B2/qE/Vqo5uoDdhFRTDB65XZDJsxxtwL1 p8L5/QKKBi/bYPlGVHwXBljNoKDJnEWFqCYIOh0zzTtUb0FP+rGlIcCx50OfqumWWMZ1 Zkxw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=47Nhj412fyl/hg8GWq0ps6rxaw9fjmOhSMQGQwR3sjU=; b=B3dDelMVneVVtXRrJtAR7miShgQQ/xXLK+hsM1iAAFXp43TkSerUTRkEMgJVwwn+2e 5lcXkVnqNekZpIaCOjKq8qdtQzbxrYeuEd8cXiEOnbMcB6ROhpqE/yWwZ44H7BlQz+FU LuA7vvgX5e+kVUPOZBmmq/EGSDnw7mKH4LLA3h0D5Rlg+0Xv9rjO56N6dN43Sq0PsQl4 y/VfGgoiWyby4drk0ZoF5eIffewIgB/aCFNIoQvvbizgEFkSc7JaaqldnZti1PaLi2NC D1yIXELehc5FETr0k01minVCTAu8aLN/Q+eJzflT6w3Rh2ytr0ckpEpCsbctB7FFC1nk SIXg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of david@redhat.com designates 66.187.233.73 as permitted sender) smtp.mailfrom=david@redhat.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from mx1.redhat.com (mx3-rdu2.redhat.com. [66.187.233.73]) by mx.google.com with ESMTPS id p43-v6si2391380qtg.155.2018.05.23.11.24.18 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 23 May 2018 11:24:18 -0700 (PDT) Received-SPF: pass (google.com: domain of david@redhat.com designates 66.187.233.73 as permitted sender) client-ip=66.187.233.73; Authentication-Results: mx.google.com; spf=pass (google.com: domain of david@redhat.com designates 66.187.233.73 as permitted sender) smtp.mailfrom=david@redhat.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id E986C400187E; Wed, 23 May 2018 18:24:17 +0000 (UTC) Received: from t460s.redhat.com (ovpn-116-62.ams2.redhat.com [10.36.116.62]) by smtp.corp.redhat.com (Postfix) with ESMTP id 59E5810C5653; Wed, 23 May 2018 18:24:16 +0000 (UTC) From: David Hildenbrand To: linux-mm@kvack.org Cc: linux-kernel@vger.kernel.org, David Hildenbrand , Martin Schwidefsky , Heiko Carstens , Vlastimil Babka , Michal Hocko , Andrew Morton , Greg Kroah-Hartman , 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 Message-Id: <20180523182404.11433-3-david@redhat.com> In-Reply-To: <20180523182404.11433-1-david@redhat.com> References: <20180523182404.11433-1-david@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.5]); Wed, 23 May 2018 18:24:18 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.5]); Wed, 23 May 2018 18:24:18 +0000 (UTC) for IP:'10.11.54.3' DOMAIN:'int-mx03.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'david@redhat.com' RCPT:'' X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: X-Virus-Scanned: ClamAV using ClamSMTP With virtio-mem, we actually want to remove memory again. Cc: Martin Schwidefsky Cc: Heiko Carstens Cc: Vlastimil Babka Cc: Michal Hocko Cc: Andrew Morton Cc: Greg Kroah-Hartman Cc: linux-s390@vger.kernel.org Signed-off-by: David Hildenbrand --- 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 */