From patchwork Wed Sep 19 10:08:15 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oscar Salvador X-Patchwork-Id: 10605579 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 B7353112B for ; Wed, 19 Sep 2018 10:08:44 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id ACAEF2B59D for ; Wed, 19 Sep 2018 10:08:44 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A0A9E2B5F2; Wed, 19 Sep 2018 10:08:44 +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 40AB42B59D for ; Wed, 19 Sep 2018 10:08:44 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 82B9E8E0006; Wed, 19 Sep 2018 06:08:41 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 7E8398E0005; Wed, 19 Sep 2018 06:08:41 -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 5B7D08E0005; Wed, 19 Sep 2018 06:08:41 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-wm1-f70.google.com (mail-wm1-f70.google.com [209.85.128.70]) by kanga.kvack.org (Postfix) with ESMTP id F3EB78E0001 for ; Wed, 19 Sep 2018 06:08:40 -0400 (EDT) Received: by mail-wm1-f70.google.com with SMTP id b186-v6so3047872wmh.8 for ; Wed, 19 Sep 2018 03:08:40 -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=0E8GrSFo/1cWrkiXCf/RJ9KCZnuIkg29ttwOJg6NQJI=; b=GNgexiYyo5n9FWMFg+PQFMUhely4Sl47MxAjrnaKpFXSQO89Pkr20ofIQ5ti0Onw1y N7Qcu0LVQ9J9Co/I4/AEtedRNGUTYYRuvAhathKn8WD1awTuiu3ChCU0ZAwmLFYqtEPq Cswr7WNaggVi9PT5GCCsVkOIofiD6CtLL+At1BIrtACjUZmZCZQvl+N4KPm6vIO7K3jU vJ6APdhMP8eHAuNatpxbrUkgFXE35qP6cC0cbysU3QzkF536ZUbkIdWXYNs88JfaCnwf iPwtNXpHjNtyxyDHi6b0Hf4790pmxtsyzDIKDdQdHrM1QDdEgoDqOasUEjjXPZSuFva6 jVdg== 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: APzg51Dpdv78kuvZ1Wbah0AgRDdVXJXcvRBiLdl6JJ03QXuhSlV8tsv6 mE2ZTd+q4TpuKrVQeK+CHDxquqQsF1Ww6wJQAQ9HhH4iYYPSr/P1o9+MW1+tmVNiPkBxCl0r4mN 9N/2s+rvDvpZA3EaAZY523lVzUbAuYaYTxWU47+ZtVOC9twJbNhIlnmV1sTm5pbMRCwc9AIXclF o/94cnV01oNMoyBRIHN4s9fA63p1An4uygwTUm2fm0o6goABM7qfi5/AH+sKf6diuRaixIGOrHj u7xpDhcVrROhdCN8N/eMc3i7vFFPnq8JAbP5xn9ncJaMoRLgHHJyoe+aJ38qnmDcCv4buHtt1tf GWP96N8sbp9ZMp09leZvf1jYJQRf1HlHav1ae3Or4gTzF/9yvVue8fGMZMhNI3AkCHS/g/4lsQ= = X-Received: by 2002:adf:bd10:: with SMTP id j16-v6mr26936154wrh.267.1537351720531; Wed, 19 Sep 2018 03:08:40 -0700 (PDT) X-Received: by 2002:adf:bd10:: with SMTP id j16-v6mr26936081wrh.267.1537351719599; Wed, 19 Sep 2018 03:08:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537351719; cv=none; d=google.com; s=arc-20160816; b=ORvagxWpGaRSaCHg2RTQsgM8+qtq9R6/ZZmEQdKBObXbLPzKwwowvbIRrwTnfF1ysF FbJ6qy5PnibqGDcIluP8ulJR/5Lvxvj599sUuBQLTE2/3Z1Q+hhWWlq+yjNW3vMhjfMM H/Krpn5pNTLmaPbRhZodxHKaNjg6Yt0ro6qHlF5mT9VxN1KvoOiThLDsvMvaXWL4RNPg AinwmCMcsU0gFodCmT0N+QmU364ez8FEPPWq9PKI85ZO/pBFAXVQOCagjCo9760aaveO zRjVScZFWAc1oioMWm4BQ2dG7ZQsvSjuUnSFlrbl2dc0rYDCF2GaTzor4ybYh4YWaxn6 PIzg== 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; bh=0E8GrSFo/1cWrkiXCf/RJ9KCZnuIkg29ttwOJg6NQJI=; b=sjafZg3xN7/vdSLEuY7k5lu92BDEQqMq/N5wB1wLMWw4dWQuA22516ES5BpHSwjcX4 JUUO+d9tS/nNVZCyO8F3P4J8/LGor1RVYSEuGCf+iJsvq9RTWPc7QCABkwrjDfOQZHkE WSROyprHuPvyCdx4ojYhrciDJENDwa+z0U+YCvN7EEQiR6XCiwkUXD+2he7XjWm4YwTX ZZMmA79uT0Qwnz46oYYzceFkqQN4+nC8kMHcqN63wKhL6mJH4L3qs/iYolQt4WwR1VBo ErVQYZscwtAL+F0dLSqkeCzyHA0JFKRQSgbiFwAtQyNZ08V7d900VEgIu+aTsOdtrT5X vB/Q== 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 l23-v6sor9496244wmc.6.2018.09.19.03.08.39 for (Google Transport Security); Wed, 19 Sep 2018 03:08:39 -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: ANB0Vdb34HC3HV+ZiMDEQ/899rzIBRO3em9du2agMFpbdsRrUU9mOEvH/Qb6iAdxyFjxFnYfjWwNwg== X-Received: by 2002:a1c:f11a:: with SMTP id p26-v6mr8343491wmh.92.1537351719329; Wed, 19 Sep 2018 03:08:39 -0700 (PDT) Received: from techadventures.net (techadventures.net. [62.201.165.239]) by smtp.gmail.com with ESMTPSA id h15-v6sm3058786wmb.21.2018.09.19.03.08.38 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 19 Sep 2018 03:08:38 -0700 (PDT) Received: from d104.suse.de (charybdis-ext.suse.de [195.135.221.2]) by techadventures.net (Postfix) with ESMTPA id A83811253C2; Wed, 19 Sep 2018 12:08:37 +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 1/5] mm/memory_hotplug: Spare unnecessary calls to node_set_state Date: Wed, 19 Sep 2018 12:08:15 +0200 Message-Id: <20180919100819.25518-2-osalvador@techadventures.net> X-Mailer: git-send-email 2.13.6 In-Reply-To: <20180919100819.25518-1-osalvador@techadventures.net> References: <20180919100819.25518-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 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,