Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp557324imm; Fri, 1 Jun 2018 05:55:08 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJRB6lAvfdEFVXUHvuR12mvdCLsamoRfqW/ODbj58I3xQSb+V/6+rS9FK07ae4hMWe2ghEl X-Received: by 2002:a62:9513:: with SMTP id p19-v6mr10811660pfd.239.1527857708315; Fri, 01 Jun 2018 05:55:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527857708; cv=none; d=google.com; s=arc-20160816; b=QAwsSzX2z2Lb4Z/DwPJIuEPfzjeOkB+UAme2IT5fiCPnyR744Fk5CHSYwz+7mCUZHr tXtI2gOG2tDb/tudR24aHhSK4zs7+4qkO1S6qDqP+al83hi5M5JSG9JUdjO1Frav/vpk fMhTXzg5iARWud6q9J81PjtMKXtvX3KVb9HaD/9TdxNCbWKwFgb9CaP4l5FE0bZA3tfp 0lZdtz39XLoDLi3dSqdHlcUEkd96pVeTBuuoR//57FOVBJcNRZIgXemSpVcxtoeBsTfR QyT5mpTNriGQT6nL22KknK99visndTUnJCAKIKyoLudUcYa/SH3CbOni1euOibmRSA0D R/DA== 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 :arc-authentication-results; bh=7lusnRLvm0+u6VaGVytGH2qZzBNliiXOKi+piOAvkak=; b=DfT6fnvuivftPgNuanXiSC3Oc2iO9OdINQflTMuBO1u8J7r/peJjf1SjMoIiv6dFDc n6JfYaalCino2MoNa0LnDDW1+zVMgdW23tX9+vnrwx3VcT1ykbJ7mSFCveBp4DU0kaR8 kSJp/Eyqo/5wB2LBlRYvCFVY+rhPYK7QH6wtCW8T4kIdImI1nvAmFshJmPAS+NJCwQoX 1CpCWV+zM6bhqezz+7Jht7SYYHGw5M7UDVcUNdAL115ZmIXKYLVt9P5/GgOf0zlhzADc xIBAgJcqaT2MPlYRr02BON+BiRPwlgJYXKh0rnycbeREdlbX+QmTQE5ggZUMbpfHfo3M 4Zrg== 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 a3-v6si14080909pll.412.2018.06.01.05.54.53; Fri, 01 Jun 2018 05:55:08 -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 S1752162AbeFAMx4 (ORCPT + 99 others); Fri, 1 Jun 2018 08:53:56 -0400 Received: from mail-wm0-f67.google.com ([74.125.82.67]:52957 "EHLO mail-wm0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751991AbeFAMxr (ORCPT ); Fri, 1 Jun 2018 08:53:47 -0400 Received: by mail-wm0-f67.google.com with SMTP id 18-v6so2867150wml.2 for ; Fri, 01 Jun 2018 05:53:46 -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=7lusnRLvm0+u6VaGVytGH2qZzBNliiXOKi+piOAvkak=; b=c3ZkGDEnkw1CuTStnLY4k9AQQ2CweCEtgZkTSPdgTjClNVp/Mu2ogOo6tu0qg7qDHD dOicoy5qrUU01CjO96YWHFd9wPpU6ED/0rPKB7MG4t+JM4rBvLMkAZaEuLuAYuaapYYd ducBVYy0QUyie6rixYesJe7rpfNDvJAKzDC/jDWBYKP/QAnuEq5G0DhIq6d2d/myEdfN YT+NAqjqKSkHDVp1Xc3JbN27slAH6L4GOVX6rEuMioOlNGrW7eDz4RTC1S35EUAsObpZ XGSoPHhirbcL6ySB+LypNG40B9btyIdd51bNA8wrkbN3j0o6KeHBkZOnMwDIvwAHbGiA 5h7g== X-Gm-Message-State: APt69E0TwDytGrZQ3ocAM9iYRHQgNGf9WXdsOE0DpbtTQwDSDXqzVsmW /DGcXmlRN9TDKjDY8sJfXqPeeqfh X-Received: by 2002:a1c:878f:: with SMTP id j137-v6mr2830379wmd.97.1527857625987; Fri, 01 Jun 2018 05:53:45 -0700 (PDT) Received: from techadventures.net (techadventures.net. [62.201.165.239]) by smtp.gmail.com with ESMTPSA id v25-v6sm827543wmh.43.2018.06.01.05.53.44 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 01 Jun 2018 05:53:45 -0700 (PDT) Received: from d104.suse.de (nat.nue.novell.com [195.135.221.2]) by techadventures.net (Postfix) with ESMTPA id 645B6123175; Fri, 1 Jun 2018 14:53:44 +0200 (CEST) From: osalvador@techadventures.net To: akpm@linux-foundation.org Cc: mhocko@suse.com, vbabka@suse.cz, pasha.tatashin@oracle.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Oscar Salvador Subject: [PATCH 0/4] Small cleanup for memoryhotplug Date: Fri, 1 Jun 2018 14:53:17 +0200 Message-Id: <20180601125321.30652-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 Hi, I wanted to give it a try and do a small cleanup in the memhotplug's code. A lot more could be done, but I wanted to start somewhere. I tried to unify/remove duplicated code. The following is what this patchset does: 1) add_memory_resource() has code to allocate a node in case it was offline. Since try_online_node has some code for that as well, I just made add_memory_resource() to use that so we can remove duplicated code.. This is better explained in patch 1/4. 2) register_mem_sect_under_node() will be called only from link_mem_sections() 3) Get rid of link_mem_sections() in favour of walk_memory_range() with a callback to register_mem_sect_under_node() 4) Drop unnecessary checks from register_mem_sect_under_node() I have done some tests and I could not see anything broken because of this patchset. Oscar Salvador (4): mm/memory_hotplug: Make add_memory_resource use __try_online_node mm/memory_hotplug: Call register_mem_sect_under_node mm/memory_hotplug: Get rid of link_mem_sections mm/memory_hotplug: Drop unnecessary checks from register_mem_sect_under_node drivers/base/memory.c | 2 - drivers/base/node.c | 52 +++++--------------------- include/linux/node.h | 21 +++++------ mm/memory_hotplug.c | 101 ++++++++++++++++++++++++++------------------------ 4 files changed, 71 insertions(+), 105 deletions(-) -- 2.13.6