From patchwork Fri Aug 10 15:29:29 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oscar Salvador X-Patchwork-Id: 10562849 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 81438174A for ; Fri, 10 Aug 2018 15:29:49 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7013D2BCD2 for ; Fri, 10 Aug 2018 15:29:49 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 648132BCD9; Fri, 10 Aug 2018 15:29:49 +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 38CEB2BCD2 for ; Fri, 10 Aug 2018 15:29:48 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 947916B0005; Fri, 10 Aug 2018 11:29:39 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 75AC06B000D; Fri, 10 Aug 2018 11:29:39 -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 4C2486B0005; Fri, 10 Aug 2018 11:29:39 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-wm0-f71.google.com (mail-wm0-f71.google.com [74.125.82.71]) by kanga.kvack.org (Postfix) with ESMTP id C27046B0008 for ; Fri, 10 Aug 2018 11:29:38 -0400 (EDT) Received: by mail-wm0-f71.google.com with SMTP id l4-v6so1433478wme.7 for ; Fri, 10 Aug 2018 08:29:38 -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=u8/RQnqvKaB52sUTxj99rxlBwtcgMKNF8ab+i1Lq2fw=; b=crY94YToYw0xzbuEG36Db4NJYX6MoPBlkLebg/GmzF76ZkTuau3WhrmGi7FPjaPh8q pbqQYmMRKK+qK0Ei7/pmjQqIQE5hGyP5ZVHDOpVCj2f2nlw3Txpc+7qiD1+XICxWd0rt M50HiwEy1oK6eGEYfSAWbrMS6eTREZdfMbbGUpLGCisgMJVWEXZbj7KnKcWXJj5s5kOh B7cn5hpYOQVqV0QT6cOp1gJO+P51ozRQaVvElfMF1OIMrLfAuzWlZQzlFQBTeZTVq5iW RMp5cSz0pJQzlKGDu521WTVRKkka3BjeoUDUsOWyWkg8OfBe34bukKbFtjSd5j5Q7POx ACVg== X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of osalvador.vilardaga@gmail.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=osalvador.vilardaga@gmail.com X-Gm-Message-State: AOUpUlHb3JOjR7aPZFYIQyYzSOoDKjTHQL8geb/O0RJ568nEUnbMYYmd HGa56baPjJjzr3khDOdJuc4ErsqoH9OcxjI5GDuIbSilygt6gPsgRBBo4DcZvxgVjvcOGnLAsZ9 QqyHaBC6G8NdO1ISGehUQpdA7inVrxVwdf4YT/EOSZsVu0DGYbifP848qYInuj38b1Sg+LY1BC7 zR8AS0aqRUXGgNWZNhKwPdPwhdKdUthDr1mNSX/7wKVkL+9rKZdsIY6YQt2pzbKtNWEm/7itRCY yI73FNQsxl0mxwQ7Y9leAxu2QlGN+Bx6h1l1a0Cdzundv4BEzyIl0Aat36oiJQ7LxeTNNd9Zaij o22meo4yE6Jo4T1gh89q+gmZX/BrFKeqS4fLKfznGnZndCT7a5FRmwELmKTBLxtoT9IEKDQg1A= = X-Received: by 2002:adf:ef03:: with SMTP id e3-v6mr4341994wro.182.1533914978183; Fri, 10 Aug 2018 08:29:38 -0700 (PDT) X-Received: by 2002:adf:ef03:: with SMTP id e3-v6mr4341958wro.182.1533914977292; Fri, 10 Aug 2018 08:29:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533914977; cv=none; d=google.com; s=arc-20160816; b=g5OwtGWnUI1JPYVVpSbd5M/tchwcqH8BL6B7YFiGQc6KeFoIoFjZbQCVsFr+GHBRsk 9zY16fXxGSKJKZiDviqkduGIs0w2W3x8rpGn+yefMZdkBdqyfd08gvkJukZL2h0gBslc gvkJRb7c4biYB0WaT190TbW56Pwq8ESYTH2DnN6sMddlPZMAGgCKL1l/YaNXiHoRSKem Oy+Wby0x834JVigh090BRy4fUTSlKz0oQbIpEfKx+VrdS+J50t39p4mAFzYJhzckZIo6 VBbX3jQAISsdK+Q3a7gFZOlB6V6dxqcKUnAWmDkfG/49AOROUb6FGiGfYWu6ktTm0/X3 KA9Q== 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=u8/RQnqvKaB52sUTxj99rxlBwtcgMKNF8ab+i1Lq2fw=; b=seZvscoX8YdTv1OZ2O8Uw8JajjfY8ddSPWwlgB0HJeUCe4K9g/TddpNxAmU7SimSWi iBFkcTvzGz3z6bhSboJJ2VnArj0wY4vAR5hnbLKB5oVe8jFWKjH3Kjldq2XeQe4cPHJZ VJJeAu2IoorwYrhEur07gaG1GnxV6CzpHHw7a3VoFMl3ccg0w1xlYTcphV4ypB1kvtQ2 /L0yWg17G3xP9qK8lGej7hLVxoSqo6hVFowlPpjGxPFnVO816QdbC9A+eEByLv1Rovr2 mWZvMDSatWcobMSW5uIjZTqoWgRnsgVQspfcAvdHsVhxI2mZCNbfrkc15VuslZS1eMkk PfTQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of osalvador.vilardaga@gmail.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=osalvador.vilardaga@gmail.com Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id 77-v6sor417636wmt.89.2018.08.10.08.29.37 for (Google Transport Security); Fri, 10 Aug 2018 08:29:37 -0700 (PDT) Received-SPF: pass (google.com: domain of osalvador.vilardaga@gmail.com designates 209.85.220.65 as permitted sender) client-ip=209.85.220.65; Authentication-Results: mx.google.com; spf=pass (google.com: domain of osalvador.vilardaga@gmail.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=osalvador.vilardaga@gmail.com X-Google-Smtp-Source: AA+uWPw8xquqFk2mp3igFhB3kf6iBPtizGpKmD/cr0FGjeXNESOrUMg8g1YikVGecqhpmi8es9gZXQ== X-Received: by 2002:a1c:a989:: with SMTP id s131-v6mr2000324wme.136.1533914975948; Fri, 10 Aug 2018 08:29:35 -0700 (PDT) Received: from techadventures.net (techadventures.net. [62.201.165.239]) by smtp.gmail.com with ESMTPSA id r12-v6sm1581899wmh.0.2018.08.10.08.29.34 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 10 Aug 2018 08:29:35 -0700 (PDT) Received: from d104.suse.de (charybdis-ext.suse.de [195.135.221.2]) by techadventures.net (Postfix) with ESMTPA id 340B612481D; Fri, 10 Aug 2018 17:29:34 +0200 (CEST) From: osalvador@techadventures.net To: akpm@linux-foundation.org Cc: mhocko@suse.com, vbabka@suse.cz, dan.j.williams@intel.com, yasu.isimatu@gmail.com, jonathan.cameron@huawei.com, david@redhat.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Oscar Salvador Subject: [PATCH 1/3] mm/memory_hotplug: Drop unused args from remove_memory_section Date: Fri, 10 Aug 2018 17:29:29 +0200 Message-Id: <20180810152931.23004-2-osalvador@techadventures.net> X-Mailer: git-send-email 2.13.6 In-Reply-To: <20180810152931.23004-1-osalvador@techadventures.net> References: <20180810152931.23004-1-osalvador@techadventures.net> 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 From: Oscar Salvador unregister_memory_section() calls remove_memory_section() with three arguments: * node_id * section * phys_device Neither node_id nor phys_device are used. Let us drop them from the function. Signed-off-by: Oscar Salvador --- drivers/base/memory.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/base/memory.c b/drivers/base/memory.c index c8a1cb0b6136..2c622a9a7490 100644 --- a/drivers/base/memory.c +++ b/drivers/base/memory.c @@ -752,8 +752,7 @@ unregister_memory(struct memory_block *memory) device_unregister(&memory->dev); } -static int remove_memory_section(unsigned long node_id, - struct mem_section *section, int phys_device) +static int remove_memory_section(struct mem_section *section) { struct memory_block *mem; @@ -785,7 +784,7 @@ int unregister_memory_section(struct mem_section *section) if (!present_section(section)) return -EINVAL; - return remove_memory_section(0, section, 0); + return remove_memory_section(section); } #endif /* CONFIG_MEMORY_HOTREMOVE */ From patchwork Fri Aug 10 15:29:30 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oscar Salvador X-Patchwork-Id: 10562845 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 8C940174A for ; Fri, 10 Aug 2018 15:29:42 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7AAD12BCD2 for ; Fri, 10 Aug 2018 15:29:42 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6D49F2BCD9; Fri, 10 Aug 2018 15:29:42 +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 158252BCD2 for ; Fri, 10 Aug 2018 15:29:42 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 319666B0008; Fri, 10 Aug 2018 11:29:39 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 2A1CF6B000D; Fri, 10 Aug 2018 11:29:39 -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 F00576B000C; Fri, 10 Aug 2018 11:29:38 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-wr1-f69.google.com (mail-wr1-f69.google.com [209.85.221.69]) by kanga.kvack.org (Postfix) with ESMTP id 8ECAE6B0005 for ; Fri, 10 Aug 2018 11:29:38 -0400 (EDT) Received: by mail-wr1-f69.google.com with SMTP id v2-v6so7229730wrr.10 for ; Fri, 10 Aug 2018 08:29:38 -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=t8JI55qiiScE0tExHnbnQS/eE8NCPsrYaAtEdiJRMhc=; b=V23Bjs7SOdM9c82JfP7UhQOM6vXC8c+46Hhn03+JaR2LHMdNBR4Hc2niQad9H0EJyd vcXpzst6j3IJ/rNP8jwn1bN+0olxXsQW9zDDUB+1x91+r5884qiIShiOsxTdW9McoL1f gcNtv8DHOYMbAEzeQRkS755x2QxSpo7U+DeiG/mobMNl3hVZEJxGV6eA+G/FIKYHK7eo bwHAZbzQBUCfvDh3m6U5bY0if3z9B4PeoToQiXYTvBULvqJlWWz9uSP+8JHJW6E+ha5S Vbo9fxkZk67EAFoqM4VR33V86P06uTxV5YO/bY72RnlAGWI5my989JnQWAYZjryJmBEn x41Q== X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of osalvador.vilardaga@gmail.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=osalvador.vilardaga@gmail.com X-Gm-Message-State: AOUpUlFcgCIC9rGJalJRlF4UV6q95YRJyWMK03X84/Mxm7j9+cbe16qb OOiGPMn1irCf7Tgc3PmXbb7HqrkbbH53MPIDLZQpYycRPzjTa4Sf5/ZdAmhX8kCXcCkwJDXJp+3 Ij8c8G9h8Xrw4T4CreNnVywpEzYzys1y5hf58HA7HFsOcui9LSKmEnq+btgkVHKCSyP0DQecRId 41T26WDfga6WAymEG8iMzzeeJCXXn89C0QguXQ/cuxzjxD7pJljmCmrvQmV5bFSAg5PeEUsTZ62 hr2EdsNnn/RtfGHP8QID164um7egJv2/pQnxIH0B35O2kX35gmUDlMEeLE2fmAEhlX4zvarpoD0 kCAQ4aAmRgYCqjNCvLXIuXlICpWJ/tXM2i7U4JVQTyStAUeBVMY7+/lJy8fHkUzgsYi+WIUBJg= = X-Received: by 2002:a1c:1584:: with SMTP id 126-v6mr1861160wmv.24.1533914978163; Fri, 10 Aug 2018 08:29:38 -0700 (PDT) X-Received: by 2002:a1c:1584:: with SMTP id 126-v6mr1861101wmv.24.1533914976738; Fri, 10 Aug 2018 08:29:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533914976; cv=none; d=google.com; s=arc-20160816; b=mbbgEUgXbDqxlT5EpGshHmagD7CGoh50qjSQSR36xGIPzkqkYNtI7Slgq77LnrZ5ls m+bMG+B6XQBQOnuUJGYpACDqhCLAFXB/qIXYXHw0hRCECM92kiWgSE0g27mScrEs2uE4 +IR70FvCf+QPkpSTxUUKZGFZAXg5hc+jYc6fBNbjAymB2QdCthO9lO1GjgBHq7mrGddk lmu0hA9i+qJHruCHqTkPbxZksqrPTJCyLK3jSrQl06VtRHfmA0hVq+q2CAnur+mFX8Qy wfhkhze0+L5lxZW61s87Zj1ha+tWfFeoAmwkws8e+36iQaFmGEwZuf9Smt/rJTHc266J tETg== 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=t8JI55qiiScE0tExHnbnQS/eE8NCPsrYaAtEdiJRMhc=; b=jDm4pLmugKvuvx/Q3rPlhEZb32Zn1X4sdCN/OdMtOglLVCofI0aGtFpm/1BbtIQiP5 +2fvosIl83d9yX6m95x+zACNKeQBGWqnFgb2nkwALu570ygFIvMAEN37u/b8FWbpALBt oasqix2ZyB4+4uFLaqSsQC7QQDOJ0eK2uxWOKfA93w3haofAygRxFD5Cwh2JoeAoGT2y bIGFe4zIWhomHPPqlrrKfC5b7Nk/G8uRsXmetE518kAWuk4uWsfdvuHoI5SaNcJHNc0N 35fWMO/nJY3beuFDjxclZXuv7qTtHjCrVvuIUa1G3El+1sQh6var1UNZRhI4YOdAohgb wtjA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of osalvador.vilardaga@gmail.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=osalvador.vilardaga@gmail.com Received: from mail-sor-f41.google.com (mail-sor-f41.google.com. [209.85.220.41]) by mx.google.com with SMTPS id e17-v6sor3961802wri.46.2018.08.10.08.29.36 for (Google Transport Security); Fri, 10 Aug 2018 08:29:36 -0700 (PDT) Received-SPF: pass (google.com: domain of osalvador.vilardaga@gmail.com designates 209.85.220.41 as permitted sender) client-ip=209.85.220.41; Authentication-Results: mx.google.com; spf=pass (google.com: domain of osalvador.vilardaga@gmail.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=osalvador.vilardaga@gmail.com X-Google-Smtp-Source: AA+uWPw1cBXuoawYK03QJrX64C+d8cn29bn7COhwbJOeE93eiV9ypINZJFUcldakDEap/pBIRGPjxw== X-Received: by 2002:adf:9007:: with SMTP id h7-v6mr4711364wrh.178.1533914976491; Fri, 10 Aug 2018 08:29:36 -0700 (PDT) Received: from techadventures.net (techadventures.net. [62.201.165.239]) by smtp.gmail.com with ESMTPSA id r12-v6sm1581907wmh.0.2018.08.10.08.29.35 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 10 Aug 2018 08:29:35 -0700 (PDT) Received: from d104.suse.de (charybdis-ext.suse.de [195.135.221.2]) by techadventures.net (Postfix) with ESMTPA id 7297612481E; Fri, 10 Aug 2018 17:29:34 +0200 (CEST) From: osalvador@techadventures.net To: akpm@linux-foundation.org Cc: mhocko@suse.com, vbabka@suse.cz, dan.j.williams@intel.com, yasu.isimatu@gmail.com, jonathan.cameron@huawei.com, david@redhat.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Oscar Salvador Subject: [PATCH 2/3] mm/memory_hotplug: Drop unneeded check from unregister_mem_sect_under_nodes Date: Fri, 10 Aug 2018 17:29:30 +0200 Message-Id: <20180810152931.23004-3-osalvador@techadventures.net> X-Mailer: git-send-email 2.13.6 In-Reply-To: <20180810152931.23004-1-osalvador@techadventures.net> References: <20180810152931.23004-1-osalvador@techadventures.net> 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 From: Oscar Salvador Before calling to unregister_mem_sect_under_nodes(), remove_memory_section() already checks if we got a valid memory_block. No need to check that again in unregister_mem_sect_under_nodes(). Signed-off-by: Oscar Salvador --- drivers/base/node.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/drivers/base/node.c b/drivers/base/node.c index 1ac4c36e13bb..dd3bdab230b2 100644 --- a/drivers/base/node.c +++ b/drivers/base/node.c @@ -455,10 +455,6 @@ int unregister_mem_sect_under_nodes(struct memory_block *mem_blk, NODEMASK_ALLOC(nodemask_t, unlinked_nodes, GFP_KERNEL); unsigned long pfn, sect_start_pfn, sect_end_pfn; - if (!mem_blk) { - NODEMASK_FREE(unlinked_nodes); - return -EFAULT; - } if (!unlinked_nodes) return -ENOMEM; nodes_clear(*unlinked_nodes); From patchwork Fri Aug 10 15:29:31 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oscar Salvador X-Patchwork-Id: 10562847 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id A4A931390 for ; Fri, 10 Aug 2018 15:29:45 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 945042BCDE for ; Fri, 10 Aug 2018 15:29:45 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 88BB32BCD9; Fri, 10 Aug 2018 15:29:45 +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 204972BCD2 for ; Fri, 10 Aug 2018 15:29:45 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 6C0176B0006; Fri, 10 Aug 2018 11:29:39 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 672216B000C; Fri, 10 Aug 2018 11:29:39 -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 3144B6B000A; Fri, 10 Aug 2018 11:29:39 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-wr1-f71.google.com (mail-wr1-f71.google.com [209.85.221.71]) by kanga.kvack.org (Postfix) with ESMTP id B33A16B0006 for ; Fri, 10 Aug 2018 11:29:38 -0400 (EDT) Received: by mail-wr1-f71.google.com with SMTP id q18-v6so7250820wrr.12 for ; Fri, 10 Aug 2018 08:29:38 -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=DThuzYFgA226wgydxOLHMV8CyK7W76Ue8dyps4MED5o=; b=ayLRU7oHZpXQePAESFvAY6mNLTXi2Bt/liSwc7GNmJsARd2J+WaF85fEjAeCZBo5h3 kuXsAd1UCGIpSGx2AFOss21w9cLS4IVLKDx0Fg6Se8OlyBk3lpNfnmHqTG/FIpYeqFOD ZwPOM2h2hWQtGVSFdX15thWOH7bXKzKZCTa687V0o1YWIAa9ILy0R4D8H1yNBdAEtjNe fl7RMx0qj2d4fr0akJuFr/0613Cwdde4ZPWMG/0bhyG2hlx7O018eVzMfNLRwJi13Gxg WpvfLkjg7nF8q8n06r3lBI/BII2rzHOJ9efphJbsZY5lbmSfsT+/2SPieqOhzEeqtRRt 7bLw== X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of osalvador.vilardaga@gmail.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=osalvador.vilardaga@gmail.com X-Gm-Message-State: AOUpUlH7z/BFNEKEFtqOUopEH/GPD3MuIJQlDy34M20HeyBPy2P0amcp E5SaccSS0rwNQgyspW73ndjmb/41JOTQfC5bzyr2E4e/D9C3JGZNCrvBjaZ9RXBOZKOlGpHPcSw CbZ3EsN75gHvA9nqdf01HjTeSm81OsooOR1ejuurRRfxtkis7ltHc20co1HP2xorVpOCcIYfMHS xye9YG2y/5UA/tqCCmK+PpmMvmV0DA6sQcrBQLp4hSMBA1MLAE5yvB67+4PNRtEdGm0TEXfe+f+ vzI0FGybYpSf5bD/jWiK579N1vlvPOSOr65CcJ1Vih5hEvtT5Uv9Fy3PFMoBsigKp+/DLQ7Jmqx Xsuw4pt89AJ8CvuaOx8TncHXiSEampiWrHZWfSo0IauPX6xWxoWlubA1WvmUknrMCoDym92BnA= = X-Received: by 2002:a1c:dacb:: with SMTP id r194-v6mr1798056wmg.56.1533914978285; Fri, 10 Aug 2018 08:29:38 -0700 (PDT) X-Received: by 2002:a1c:dacb:: with SMTP id r194-v6mr1798021wmg.56.1533914977324; Fri, 10 Aug 2018 08:29:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533914977; cv=none; d=google.com; s=arc-20160816; b=Shr2Q7q/gSR8KGgYdWmk7sdoq7x4zK4Q1JtktTzefHFrAC8OvgRS4xyrVKz79LP35+ ELv/TB5opJUK1WJcaLz5dV4nZPpBPOCkqD7x6jXweWVsxh8qXSbBB9GiP8qpQRqG1JpW fHEr/X9VUvdLeEPPKFIkGPEYn3C4Ud2HWu5ZoAAtyAwqg5lVdXTVl8Eab/F/sHBV7a06 Wohwjwq8eGmKXw08tEyY2dLbqLbpoRq1zBHLeXrggViaZXe5jmOE/YwKCvMujLsVGR3j Vl8cfhiTBsJn+EsRgWkwq1wZSDKu0UaVCjJEyldQ9NuBISQpocbAn5CQfXueMNt+0krt Ld+w== 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=DThuzYFgA226wgydxOLHMV8CyK7W76Ue8dyps4MED5o=; b=uNijlRpCB3HjDx0hSH8c40icW8NMdCvGWvybt55yaOzFQZXTxDCr+RqSH0cOWiwilJ 7wvZiywJNA9TQOAYmr1cWjBQOrAF/P8HJpF08/DDhsSBmzEHX4rqPdDAN2wgV+jbkRQm ryCAINVnzVtKslYYIpf1EcAWoZ4AV81NqwJq13XemqPyqKHaVuAWY2y6KQ35uel90/pB OCJShOOT+WpzTb5n51uHIZdJmdpjQLiVHaOLcUlYwsDQFvPU3rDQ7utzOr3J2c+DfgpZ Vv/VC0E3NVk79iR/W2v+NvM3gK/nN8+Th8xrIDr4rxE2BDCRKD4B5GQ5eO/378srgaiI ta8w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of osalvador.vilardaga@gmail.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=osalvador.vilardaga@gmail.com Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id 16-v6sor292153wms.81.2018.08.10.08.29.37 for (Google Transport Security); Fri, 10 Aug 2018 08:29:37 -0700 (PDT) Received-SPF: pass (google.com: domain of osalvador.vilardaga@gmail.com designates 209.85.220.65 as permitted sender) client-ip=209.85.220.65; Authentication-Results: mx.google.com; spf=pass (google.com: domain of osalvador.vilardaga@gmail.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=osalvador.vilardaga@gmail.com X-Google-Smtp-Source: AA+uWPzbs36MxCTUWcZ9pj2HjX2ZyzIipgHJh9Tm0gNRoWHVIbPlItS90THDEvmfRh2AMypOByfCDA== X-Received: by 2002:a1c:b45:: with SMTP id 66-v6mr1816958wml.45.1533914977055; Fri, 10 Aug 2018 08:29:37 -0700 (PDT) Received: from techadventures.net (techadventures.net. [62.201.165.239]) by smtp.gmail.com with ESMTPSA id n7-v6sm8811166wrr.35.2018.08.10.08.29.35 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 10 Aug 2018 08:29:35 -0700 (PDT) Received: from d104.suse.de (charybdis-ext.suse.de [195.135.221.2]) by techadventures.net (Postfix) with ESMTPA id B0EA412481F; Fri, 10 Aug 2018 17:29:34 +0200 (CEST) From: osalvador@techadventures.net To: akpm@linux-foundation.org Cc: mhocko@suse.com, vbabka@suse.cz, dan.j.williams@intel.com, yasu.isimatu@gmail.com, jonathan.cameron@huawei.com, david@redhat.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Oscar Salvador Subject: [PATCH 3/3] mm/memory_hotplug: Cleanup unregister_mem_sect_under_nodes Date: Fri, 10 Aug 2018 17:29:31 +0200 Message-Id: <20180810152931.23004-4-osalvador@techadventures.net> X-Mailer: git-send-email 2.13.6 In-Reply-To: <20180810152931.23004-1-osalvador@techadventures.net> References: <20180810152931.23004-1-osalvador@techadventures.net> 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 From: Oscar Salvador With the assumption that the relationship between memory_block <-> node is 1:1, we can refactor this function a bit. This assumption is being taken from register_mem_sect_under_node() code. register_mem_sect_under_node() takes the mem_blk's nid, and compares it to the pfn's nid we are checking. If they match, we go ahead and link both objects. Once done, we just return. So, the relationship between memory_block <-> node seems to stand. Currently, unregister_mem_sect_under_nodes() defines a nodemask_t which is being checked in the loop to see if we have already unliked certain node. But since a memory_block can only belong to a node, we can drop the nodemask and the check within the loop. If we find a match between the mem_block->nid and the nid of the pfn we are checking, we unlink the objects and return, as unlink the objects once is enough. Signed-off-by: Oscar Salvador --- drivers/base/node.c | 30 +++++++++++------------------- 1 file changed, 11 insertions(+), 19 deletions(-) diff --git a/drivers/base/node.c b/drivers/base/node.c index dd3bdab230b2..0657ed70bddd 100644 --- a/drivers/base/node.c +++ b/drivers/base/node.c @@ -448,35 +448,27 @@ int register_mem_sect_under_node(struct memory_block *mem_blk, void *arg) return 0; } -/* unregister memory section under all nodes that it spans */ +/* unregister memory section from the node it belongs to */ int unregister_mem_sect_under_nodes(struct memory_block *mem_blk, unsigned long phys_index) { - NODEMASK_ALLOC(nodemask_t, unlinked_nodes, GFP_KERNEL); unsigned long pfn, sect_start_pfn, sect_end_pfn; - - if (!unlinked_nodes) - return -ENOMEM; - nodes_clear(*unlinked_nodes); + int nid = mem_blk->nid; sect_start_pfn = section_nr_to_pfn(phys_index); sect_end_pfn = sect_start_pfn + PAGES_PER_SECTION - 1; for (pfn = sect_start_pfn; pfn <= sect_end_pfn; pfn++) { - int nid; + int page_nid = get_nid_for_pfn(pfn); - nid = get_nid_for_pfn(pfn); - if (nid < 0) - continue; - if (!node_online(nid)) - continue; - if (node_test_and_set(nid, *unlinked_nodes)) - continue; - sysfs_remove_link(&node_devices[nid]->dev.kobj, - kobject_name(&mem_blk->dev.kobj)); - sysfs_remove_link(&mem_blk->dev.kobj, - kobject_name(&node_devices[nid]->dev.kobj)); + if (page_nid >= 0 && page_nid == nid) { + sysfs_remove_link(&node_devices[nid]->dev.kobj, + kobject_name(&mem_blk->dev.kobj)); + sysfs_remove_link(&mem_blk->dev.kobj, + kobject_name(&node_devices[nid]->dev.kobj)); + break; + } } - NODEMASK_FREE(unlinked_nodes); + return 0; }