Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp668599imm; Fri, 21 Sep 2018 06:27:17 -0700 (PDT) X-Google-Smtp-Source: ANB0VdbMoFTPJDEUQnU71a1pm8vRbw2X5inXWH6DUOuQ+JQnB99pMj0NW/uDVnxmDW/L0T2D+aaW X-Received: by 2002:a63:5c10:: with SMTP id q16-v6mr41248942pgb.452.1537536437395; Fri, 21 Sep 2018 06:27:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537536437; cv=none; d=google.com; s=arc-20160816; b=0iT6E+839RTrylcMSlW1Vfa/Un7O47MVlRRcyVz0GwJIBKRYrxEzTGc891G9p8dlMy ISfpSvMI3bQ/PR2eNvJdmi5YH9UqbQdtzHS8bFM4bpCpw1AFGjYLRpQF/xJ78bZoQYxq xmRHUkwa66apGEULWZ00TQ19LrLBCPcAGPgaiJXJa89FaKO+0jIc/E0FTVVgYMAXd4Fd Ft9SdkokNdqRLwjY7tb8lHOrrA8x16NmeJimltCQREThMsEN4CCwgQvKjrh2h54ibuul ev0x7asqwQ/Fdh+UHu2Ov5AEQ2VlfMTl3c8s73+R9wjjZYBQC7IP+nk6mejguApdcx2u MklA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=Qxl2mXI3o+wV6JwzDlazHiKHGPEuy6rtVwzXjk1okdE=; b=RX8qEtwP8B/zNm5P0lzwXghtL7rI7hLyKme0cPpZbsN2n/Bu5YIsRZKITih4Bz+pkn hI5zhip0FOOT6wnPKlMf+KjjBcGuzA6KGy/ElUVK7HHtD61Zt+460EEvILvGtakQcaK9 jGx/JHcKqbN5S8l6WQqjmF75qHCi0dqBBEO0/Bf/TmpeC3lyKU4+0E7MczOqmsHREfnc INkioeZcco0WPDMOgtRrGFHPNMVd5iZB52CkEGp4pFVuFj+tBpufghF18YEQza17tVwf nvU8EKUk8USu0DPxuHIra4hOIhIjBVMS7sn6aju+wGsD3+u2eZnRobWXAgs5cepABbLM 7STg== 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 x32-v6si26877071pld.356.2018.09.21.06.26.57; Fri, 21 Sep 2018 06:27:17 -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 S2390144AbeIUTPk (ORCPT + 99 others); Fri, 21 Sep 2018 15:15:40 -0400 Received: from mail-wm1-f66.google.com ([209.85.128.66]:54737 "EHLO mail-wm1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727857AbeIUTPi (ORCPT ); Fri, 21 Sep 2018 15:15:38 -0400 Received: by mail-wm1-f66.google.com with SMTP id c14-v6so3063473wmb.4 for ; Fri, 21 Sep 2018 06:26:45 -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:in-reply-to :references; bh=Qxl2mXI3o+wV6JwzDlazHiKHGPEuy6rtVwzXjk1okdE=; b=YK7piOuJf+DMNmfcMPWeA9TGzAGlJwjqfK2Cv/inOpXiPxw2/gdEOtBm4gDNuhE5pT kvB+y3g42qhkcNjoFo8KG2AIg/jRafey0mOeXptRSgP4PUa7RZBtpi/kw3U/l7nshMtZ F3Lw+mgGndAaLIvzKRLaDuDMoZuwmzuTiy2yGn/RuLHmnL1hX8vFDTBh3anl0OTOuWYa POZE15LwM1EH1bU2C3KvRhk5ZEs3R9rrfSyZWWSEAISxBKNvDPs/+kaZ07N2gC+dj3Yg rbfoCsN5+PGDRdFMtdvcUxN4rBkjVt458kc3JwUbDBrRVb0aCuM55fXyCrO9a6q4LRZx 2GVw== X-Gm-Message-State: APzg51A4PIfcNAWZKqPrMLx+SQEup3swso0dQFXOX/5bRjlQGv1hpbHA 3s014HXa3ViWAf1uS/Obdv8= X-Received: by 2002:a1c:b5d3:: with SMTP id e202-v6mr7170862wmf.23.1537536401935; Fri, 21 Sep 2018 06:26:41 -0700 (PDT) Received: from techadventures.net (techadventures.net. [62.201.165.239]) by smtp.gmail.com with ESMTPSA id 75-v6sm7858782wml.21.2018.09.21.06.26.40 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 21 Sep 2018 06:26:41 -0700 (PDT) Received: from d104.suse.de (nat.nue.novell.com [195.135.221.2]) by techadventures.net (Postfix) with ESMTPA id 0DA31125332; Fri, 21 Sep 2018 15:26:40 +0200 (CEST) From: Oscar Salvador To: akpm@linux-foundation.org Cc: mhocko@suse.com, dan.j.williams@intel.com, david@redhat.com, Pavel.Tatashin@microsoft.com, Jonathan.Cameron@huawei.com, yasu.isimatu@gmail.com, malat@debian.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Oscar Salvador Subject: [PATCH v2 1/4] mm/memory_hotplug: Spare unnecessary calls to node_set_state Date: Fri, 21 Sep 2018 15:26:31 +0200 Message-Id: <20180921132634.10103-2-osalvador@techadventures.net> X-Mailer: git-send-email 2.13.6 In-Reply-To: <20180921132634.10103-1-osalvador@techadventures.net> References: <20180921132634.10103-1-osalvador@techadventures.net> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 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. Fix this by checking status_change_nid. Signed-off-by: Oscar Salvador Reviewed-by: Pavel Tatashin --- 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 38d94b703e9d..63facfc57224 100644 --- a/mm/memory_hotplug.c +++ b/mm/memory_hotplug.c @@ -753,7 +753,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, -- 2.13.6