Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp4064217imm; Mon, 15 Oct 2018 08:33:07 -0700 (PDT) X-Google-Smtp-Source: ACcGV60dBKj/pxb3bkKNXhurMXE5Xwg1nZPFZyLK8xt0AHg2tIO/Zeb4++zrtRfw60Lhn3oRWc3z X-Received: by 2002:a63:27c1:: with SMTP id n184-v6mr16513480pgn.334.1539617587377; Mon, 15 Oct 2018 08:33:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539617587; cv=none; d=google.com; s=arc-20160816; b=GMNJq/WgZhfNRJ0OO/VdAUrqg5H9dO8l7uDLFWRYVqNc056LrwxJmDOpZ5tP8bnuBO H53MZYZQiDLNwoSRctI0MjVtiaYmB8zUvQGiuwRq8npL9ezYPZnOOCWX7goxg+utuSMu 20RJmNbIl6yGu+22fW7XIFJDihehuiutpwLSFYMwoNBYHYyag5Ev92Gk8LvqOv/AtgFE IX/JjXCAOcxia9RvVqbc3aSXhJdTNCnz/uyt15hloiCyq3IZyNQLwayKjsXxGaeYjoRa 5O0X/Wmei+t5vU4ij3u92AqCGKfE0PaRxL3xo1ftai/bQrXHfOsI/jh7XmmtSh0lMrPy tycQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from; bh=LU4r8F9ALUwSKM0hFeYt7FRRV25cfLCEn+tw+FqJXU0=; b=xoxCrit9I+6cuMrWgBX/zCXj4ybJ3aE7kGhoS/z2pmAk5b3XsxIHXHRczP7QhGLrvz Qavog9PVzn4vQBAVSXdvarPO6Uyr7ZPCm4TgcQLg5BKAPc/cDRZXQ4KK5/t4+sqxRoCl dzHoZw0WoWA9+CK3mdoSTXAXsYE06cOBx14VjuCw1gMMPGLHwTf63euT60LXhpE0FGb+ J/WW6pvU0+0D/+YdkJPUT/PTtjs+Kk0Xsna4GC2idiYgpcjuJDtb4AAwBUSQwaEWQYpi gRObVniK8snYjHC5E3M11OFwiS767gwiVXpqfMofGEwYQ8C4GVQGRM75WkTypu2+4ZJQ M3Xw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b13-v6si10453566pgg.89.2018.10.15.08.32.52; Mon, 15 Oct 2018 08:33:07 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726614AbeJOXQj (ORCPT + 99 others); Mon, 15 Oct 2018 19:16:39 -0400 Received: from mail-wm1-f50.google.com ([209.85.128.50]:36752 "EHLO mail-wm1-f50.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726422AbeJOXQi (ORCPT ); Mon, 15 Oct 2018 19:16:38 -0400 Received: by mail-wm1-f50.google.com with SMTP id a8-v6so20036350wmf.1 for ; Mon, 15 Oct 2018 08:30:53 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=LU4r8F9ALUwSKM0hFeYt7FRRV25cfLCEn+tw+FqJXU0=; b=YW2691xyD+C0apzg5mHXs1nsEyGTOybImAxcPYQXeYH8eBw2lpnXHwCCu0ijmFW2Vy PHKveswKi8m1LGOJHDXLJXEz/rXJrREV0VFychP6hIYpphZ++rnW4nEASmL8RiYCNGge 0aYYMfcSONTAEIa8cPPYet7YsDCOZiDllXGf5N48/OUUI4CYDXdZT7te2oEab9jR0QJo O/q5wcQWGnPO5JADY0FGkUEVWnm1/CPRG0rPV8c1c9xOGg+zWxq4ab8V06iSHPLP5yyE 4/vO4ovsslWv1nCk3fDPQbCciKf5yqRkBzzwaCMZR1ldQg3qOuTL/VwA50i8O8YclSX4 AE7Q== X-Gm-Message-State: ABuFfogOYERkI5E+m1a2hLqWepQa+Hd4fwVdCKLQ+AbqfMoZnyGaSmN4 VtVCdyjO7oE2xwLpLOWHOlc= X-Received: by 2002:a7b:c00a:: with SMTP id c10-v6mr13207541wmb.73.1539617452849; Mon, 15 Oct 2018 08:30:52 -0700 (PDT) Received: from techadventures.net (techadventures.net. [62.201.165.239]) by smtp.gmail.com with ESMTPSA id k7-v6sm10931764wmf.22.2018.10.15.08.30.51 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 15 Oct 2018 08:30:52 -0700 (PDT) Received: from d104.suse.de (charybdis-ext.suse.de [195.135.221.2]) by techadventures.net (Postfix) with ESMTPA id 398DF1251F0; Mon, 15 Oct 2018 17:30:51 +0200 (CEST) From: Oscar Salvador To: akpm@linux-foundation.org Cc: mhocko@suse.com, dan.j.williams@intel.com, yasu.isimatu@gmail.com, rppt@linux.vnet.ibm.com, malat@debian.org, linux-kernel@vger.kernel.org, pavel.tatashin@microsoft.com, jglisse@redhat.com, Jonathan.Cameron@huawei.com, rafael@kernel.org, david@redhat.com, dave.jiang@intel.com, linux-mm@kvack.org, alexander.h.duyck@linux.intel.com, Oscar Salvador Subject: [PATCH 0/5] Do not touch pages/zones during hot-remove path Date: Mon, 15 Oct 2018 17:30:29 +0200 Message-Id: <20181015153034.32203-1-osalvador@techadventures.net> X-Mailer: git-send-email 2.13.6 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Oscar Salvador This patchset aims to solve [1] and [2] issues. Due to the lack of feedback of previous versions, I decided to go safe, so I reverted some of the changes I did in RFCv3: 1) It is no longer based on [3], although the code would be easier and the changes less. 2) hotplug lock stays in HMM/devm, mainly because I am not sure whether it is ok to leave the kasan calls out of lock or not. If we think that this can be done, the hotplug lock can be moved within add/del_device_memory, which would be nicer IMHO. 3) Although I think that init_currently_empty_zone should be protected by the spanlock since it touches zone_start_pfn, I decided to leave it as it is right now. The main point of moving it within the lock was to be able to move move_pfn_range_to_zone out of the hotplug lock for HMM/devm code. The main point of this patchset is to move all the page/zone handling from the hot-remove path, back to the offlining stage. In this way, we can better split up what each part does: * hot-add path: - Create a new resource for the hot-added memory - Create memory sections for the hot-added memory - Create the memblocks representing the hot-added memory * online path: - Re-adjust zone/pgdat nr of pages (managed, spanned, present) - Initialize the pages from the new memory-range - Online memory sections * offline path: - Offline memory sections - Re-adjust zone/pgdat nr of pages (managed, spanned, present) * hot-remove path: - Remove memory sections - Remove memblocks - Remove resources So, hot-add/remove stages should only care about sections and memblocks. While all the zone/page handling should belong to the online/offline stage. Another thing is that for the sake of reviewability, I split the patchset in 5 parts, but pathc3 could be combined into patch4. This patchset is based on top of mmotm. [1] https://patchwork.kernel.org/patch/10547445/ [2] https://www.spinics.net/lists/linux-mm/msg161316.html [3] https://patchwork.kernel.org/cover/10613425/ Oscar Salvador (5): mm/memory_hotplug: Add nid parameter to arch_remove_memory mm/memory_hotplug: Create add/del_device_memory functions mm/memory_hotplug: Check for IORESOURCE_SYSRAM in release_mem_region_adjustable mm/memory_hotplug: Move zone/pages handling to offline stage mm/memory-hotplug: Rework unregister_mem_sect_under_nodes arch/ia64/mm/init.c | 6 +- arch/powerpc/mm/mem.c | 14 +--- arch/s390/mm/init.c | 2 +- arch/sh/mm/init.c | 6 +- arch/x86/mm/init_32.c | 6 +- arch/x86/mm/init_64.c | 11 +--- drivers/base/memory.c | 9 ++- drivers/base/node.c | 38 ++--------- include/linux/memory.h | 2 +- include/linux/memory_hotplug.h | 21 ++++-- include/linux/node.h | 9 ++- kernel/memremap.c | 13 ++-- kernel/resource.c | 16 +++++ mm/hmm.c | 35 +++++----- mm/memory_hotplug.c | 142 +++++++++++++++++++++++++---------------- mm/sparse.c | 6 +- 16 files changed, 177 insertions(+), 159 deletions(-) -- 2.13.6