From patchwork Wed Aug 22 09:32:22 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oscar Salvador X-Patchwork-Id: 10572773 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 1C6B9112E for ; Wed, 22 Aug 2018 09:32:38 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0F4AF2AA30 for ; Wed, 22 Aug 2018 09:32:38 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 03399298D3; Wed, 22 Aug 2018 09:32:37 +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 920D1298D3 for ; Wed, 22 Aug 2018 09:32:37 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 4855E6B23AD; Wed, 22 Aug 2018 05:32:35 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 3A06B6B23AE; Wed, 22 Aug 2018 05:32:35 -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 0DCF56B23AE; Wed, 22 Aug 2018 05:32:34 -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 9550B6B23AC for ; Wed, 22 Aug 2018 05:32:34 -0400 (EDT) Received: by mail-wm0-f71.google.com with SMTP id v24-v6so1324387wmh.5 for ; Wed, 22 Aug 2018 02:32:34 -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=zqnYEmFfSStfubGMhFL+km+dqzq3LfNEkBqGNnMeElQ=; b=grfsZcxrbucLJ5piA98Df107SArR5tR8ZSKhE0QyNW5mLKzMeCzn2rKbW/6+mJwZN+ edhjGAg04txqhy8dbW0Ql9mgmWCvPucFhALI4OE1Fa2bA6SKFMYLpe8Jy/NqHsTlcM/F TfAJ2OPSPGVRHOYFu0Gs4o7X6OIFbee6ZQdWjuEkSB+1F/X7KHgsmCvBQiRN4m41+TqJ T/mBzQNLMKCFbgtsFIDPKzHNQlV7BaaHypSt7P4AVSdghEKXyoIhtos9AHtnJvypPoRp bTrikGKb5kiUN+aliYriQjJU0miaqzoGbrcNxiwh8+JnAfuNdryHuVBHmVc1m2GaUJSO BMlg== 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: APzg51B7o2V8Ctf2Qii7OXcIi8XOJvBTUCP6PQi4uibIzXSmCVW2KHtG uQsXcTAEf0oF3399+dl8pxvtj5WxepUKOyeb8OkDLaP/qrWC6w4P1WJRL7ZzIpKVKH4p7mkftU3 a2w0TB7HJJB5vftahGfBqgiSpQZB8zhhG9W57iTuxPO0oXlqKgPNPbr9w0OG61J+eK15aNXOxHG XB4qpahnNdPMwveEGG/4s+p4CQsML24v8Umo3IMdSr22kOoQaPn9S63wJb5zySbNKVNJDK9rEGR s58QLuv7gcAruptWHAsf4BdB6D1avQw1wHP72UWvRujRcDHED4GPCQziN0azUBQV0j/X4TToZ3X sJhgXDigG2lz3iKjBkI9vmVms/1RvHh0LI21HZTZlwaYjiOx6v3hc/vml0Kki4mcr0dnwfNZRw= = X-Received: by 2002:a1c:4405:: with SMTP id r5-v6mr1742118wma.4.1534930354105; Wed, 22 Aug 2018 02:32:34 -0700 (PDT) X-Received: by 2002:a1c:4405:: with SMTP id r5-v6mr1742092wma.4.1534930353295; Wed, 22 Aug 2018 02:32:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1534930353; cv=none; d=google.com; s=arc-20160816; b=uzjN3utTvFmS23NW7O+Z0ivQUQb215JrPsQpKlueJe0RXOD8im9bfmLgfCWs+iIFCm vKB2vikbj2IOZB/KT2DxBdAni3TiQtmRk1oBtB7T242bLLVGKdebYCx1a+gjkKBPNpIT X0Om5YPa4sxYKx1giCBk8Jk3zGdGyZHQPk6RRy6YKCWUDxpxqNILMNnMHv4KPiiZQHMG zXonzZqmll0Eb2tVjoZ6ZptQtraPFsVzjgA1gXGEZCeehMVPS/rfEcPAd7ckxQcj3Rf7 eg5/M/BbL54Erb1Fxy1CZfmQZSEvFrDd5tLh63+xik90+dzRpN9NSFajEnq8efxTA7x7 94Fg== 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=zqnYEmFfSStfubGMhFL+km+dqzq3LfNEkBqGNnMeElQ=; b=mbR25rUABmzajzZ0h9D5E+B0+fDUM4C6BvZmnhqXP0aveqXzyAO6FAmaOI8zGbq0zC Ui/DZFLdCGCH5L9RZVcn14J9LAwtbJj5TpgxRSoT5KY8wNlhjd0YLuhBjW3v/I5CvO5t URISAgO2B0yxkV0TDuSoBSI69OER1kpcsDm3ZuPM5osOFbgAZgK9V/h8BWezqiznpmVR QuZqkebFfTeo7EAXBLVMFNqC5YIHnO5PbSJBUV8PlfbeNaPA7ZifoBM5bGmX4Q+D2wji 5GUH5oRk5qPJr9d+yYKXJ9wj9WB92cubtywHygLQ08jRo4yB9s2ZmoOHYQpxUMmT3tEv r1HQ== 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 v7-v6sor394537wrn.87.2018.08.22.02.32.33 for (Google Transport Security); Wed, 22 Aug 2018 02:32:33 -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: ANB0VdaMqTgfSCWdBjDRWYuv35U7h8b01944NhHcAT1EEOisqVc/6/il5v1eAiDgMt/VUXU7oa0A+A== X-Received: by 2002:adf:9101:: with SMTP id j1-v6mr10482285wrj.3.1534930353055; Wed, 22 Aug 2018 02:32:33 -0700 (PDT) Received: from techadventures.net (techadventures.net. [62.201.165.239]) by smtp.gmail.com with ESMTPSA id q3-v6sm1148938wmf.21.2018.08.22.02.32.31 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 22 Aug 2018 02:32:32 -0700 (PDT) Received: from d104.suse.de (nat.nue.novell.com [195.135.221.2]) by techadventures.net (Postfix) with ESMTPA id E69A3124A13; Wed, 22 Aug 2018 11:32:30 +0200 (CEST) From: Oscar Salvador To: akpm@linux-foundation.org Cc: mhocko@suse.com, dan.j.williams@intel.com, malat@debian.org, david@redhat.com, Pavel.Tatashin@microsoft.com, linux-kernel@vger.kernel.org, linux-mm@kvack.org, Oscar Salvador Subject: [RFC PATCH 1/5] mm/memory_hotplug: Spare unnecessary calls to node_set_state Date: Wed, 22 Aug 2018 11:32:22 +0200 Message-Id: <20180822093226.25987-2-osalvador@techadventures.net> X-Mailer: git-send-email 2.13.6 In-Reply-To: <20180822093226.25987-1-osalvador@techadventures.net> References: <20180822093226.25987-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 In node_states_check_changes_online, we check if the node will have to be set for any of the N_*_MEMORY states after the pages have been onlined. Later on, we perform the activation in node_states_set_node. Currently, in node_states_set_node we set the node to N_MEMORY unconditionally. This means that we will call node_set_state for N_MEMORY every time pages go online, but we only need to do it if the node has not yet been set for N_MEMORY. Signed-off-by: Oscar Salvador --- mm/memory_hotplug.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c index 60b67f09956e..4a89915e1467 100644 --- a/mm/memory_hotplug.c +++ b/mm/memory_hotplug.c @@ -746,7 +746,8 @@ static void node_states_set_node(int node, struct memory_notify *arg) if (arg->status_change_nid_high >= 0) node_set_state(node, N_HIGH_MEMORY); - node_set_state(node, N_MEMORY); + if (arg->status_change_nid >= 0) + node_set_state(node, N_MEMORY); } static void __meminit resize_zone_range(struct zone *zone, unsigned long start_pfn,