From patchwork Wed Apr 24 10:25:04 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Hildenbrand X-Patchwork-Id: 1090054 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 44pxPQ2FPZz9s4V for ; Wed, 24 Apr 2019 20:28:58 +1000 (AEST) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 44pxPQ1G5hzDqVR for ; Wed, 24 Apr 2019 20:28:58 +1000 (AEST) X-Original-To: linuxppc-dev@lists.ozlabs.org Delivered-To: linuxppc-dev@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=redhat.com (client-ip=209.132.183.28; helo=mx1.redhat.com; envelope-from=david@redhat.com; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=pass (p=none dis=none) header.from=redhat.com Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 44pxKf4WKrzDqDJ for ; Wed, 24 Apr 2019 20:25:41 +1000 (AEST) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 9E2923199364; Wed, 24 Apr 2019 10:25:33 +0000 (UTC) Received: from t460s.redhat.com (ovpn-116-45.ams2.redhat.com [10.36.116.45]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2CDA8600C4; Wed, 24 Apr 2019 10:25:12 +0000 (UTC) From: David Hildenbrand To: linux-mm@kvack.org Subject: [PATCH v1 0/7] mm/memory_hotplug: Factor out memory block device handling Date: Wed, 24 Apr 2019 12:25:04 +0200 Message-Id: <20190424102511.29318-1-david@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.41]); Wed, 24 Apr 2019 10:25:38 +0000 (UTC) X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Oscar Salvador , Michal Hocko , linux-ia64@vger.kernel.org, linux-sh@vger.kernel.org, Peter Zijlstra , Dave Hansen , Heiko Carstens , Chris Wilson , Masahiro Yamada , Pavel Tatashin , Rich Felker , Arun KS , "H. Peter Anvin" , Ingo Molnar , "Rafael J. Wysocki" , Qian Cai , linux-s390@vger.kernel.org, Baoquan He , Logan Gunthorpe , David Hildenbrand , Mike Rapoport , Ingo Molnar , Fenghua Yu , Pavel Tatashin , Vasily Gorbik , Rob Herring , "mike.travis@hpe.com" , Nicholas Piggin , Martin Schwidefsky , Mark Brown , Borislav Petkov , Andy Lutomirski , Jonathan Cameron , Dan Williams , Wei Yang , Joonsoo Kim , Oscar Salvador , Tony Luck , Yoshinori Sato , Andrew Banman , Mathieu Malaterre , Greg Kroah-Hartman , linux-kernel@vger.kernel.org, Mike Rapoport , Thomas Gleixner , Wei Yang , Alex Deucher , Paul Mackerras , akpm@linux-foundation.org, linuxppc-dev@lists.ozlabs.org, "David S. Miller" , "Kirill A. Shutemov" Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" We only want memory block devices for memory to be onlined/offlined (add/remove from the buddy). This is required so user space can online/offline memory and kdump gets notified about newly onlined memory. Only such memory has the requirement of having to span whole memory blocks. Let's factor out creation/removal of memory block devices. This helps to further cleanup arch_add_memory/arch_remove_memory() and to make implementation of new features (e.g. sub-section hot-add) easier. Patch 1 makes sure the memory block size granularity is always respected. Patch 2 implements arch_remove_memory() on s390x. Patch 3 prepares arch_remove_memory() to be also called without CONFIG_MEMORY_HOTREMOVE. Patch 4,5 and 6 factor out creation/removal of memory block devices. Patch 7 gets rid of some unlikely errors that could have happened, not removinf links between memory block devices and nodes, previously brought up by Oscar. Did a quick sanity test with DIMM plug/unplug, making sure all devices and sysfs links properly get added/removed. Compile tested on s390x and x86-64. Based on git://git.cmpxchg.org/linux-mmots.git David Hildenbrand (7): mm/memory_hotplug: Simplify and fix check_hotplug_memory_range() s390x/mm: Implement arch_remove_memory() mm/memory_hotplug: arch_remove_memory() and __remove_pages() with CONFIG_MEMORY_HOTPLUG mm/memory_hotplug: Create memory block devices after arch_add_memory() mm/memory_hotplug: Drop MHP_MEMBLOCK_API mm/memory_hotplug: Remove memory block devices before arch_remove_memory() mm/memory_hotplug: Make unregister_memory_block_under_nodes() never fail arch/ia64/mm/init.c | 2 - arch/powerpc/mm/mem.c | 2 - arch/s390/mm/init.c | 15 +++-- arch/sh/mm/init.c | 2 - arch/x86/mm/init_32.c | 2 - arch/x86/mm/init_64.c | 2 - drivers/base/memory.c | 109 +++++++++++++++++++-------------- drivers/base/node.c | 27 +++----- include/linux/memory.h | 6 +- include/linux/memory_hotplug.h | 10 --- include/linux/node.h | 7 +-- mm/memory_hotplug.c | 42 +++++-------- mm/sparse.c | 6 -- 13 files changed, 100 insertions(+), 132 deletions(-)