From patchwork Fri Sep 21 13:26: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: 10610035 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 90814112B for ; Fri, 21 Sep 2018 13:26:55 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7FEBF2DB18 for ; Fri, 21 Sep 2018 13:26:55 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7262E2DB1A; Fri, 21 Sep 2018 13:26:55 +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 1853B2DB18 for ; Fri, 21 Sep 2018 13:26:55 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 9628F8E0006; Fri, 21 Sep 2018 09:26:50 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 93A0A8E0001; Fri, 21 Sep 2018 09:26:50 -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 82CD08E0006; Fri, 21 Sep 2018 09:26:50 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-wr1-f70.google.com (mail-wr1-f70.google.com [209.85.221.70]) by kanga.kvack.org (Postfix) with ESMTP id 2562F8E0001 for ; Fri, 21 Sep 2018 09:26:50 -0400 (EDT) Received: by mail-wr1-f70.google.com with SMTP id v6-v6so1368448wrr.20 for ; Fri, 21 Sep 2018 06:26:50 -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=Qxl2mXI3o+wV6JwzDlazHiKHGPEuy6rtVwzXjk1okdE=; b=K05B15M4KIl0aZC6UfhOArTcaHJ8+ctDaDoKGFc0AT2FdXWKbu87dksfZe7KN3NqRu UsCQQHDB8/DWvoVjaf/lr6lbqZwV/nQSHCmELdRBDPcHyiggfoYVdZhQanz3SPxkBM+T RQA1gHS3MtwiteVj5coxEjwhzpuMvkjH/O/sKmv6zkXszOeMjfX4Z+k2I4XEGrcYm4/Q vxZhKJ7CmI+vjbpm3iRya9r9k0I6V5VdBzTIXqRnS3u+kVq4rbM4nQBFGba4/6Z5TakO TpS6zFo2ilBHTqvycjs0pBCR08vjCwKY1MXfnXy1fYplVRTT+84wjUpQEVKODQUbpcdu ZfvA== 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: APzg51COFHhmcBtT98w9rN4JLYF856nL0fI+QYcQc/NXdAlSVbN9Cuhg TddEZbdTaLpb9Qrtsd6X3v5SB/q71Mkl0cdsyQ7lWHjFIQQZrjy+kMXIMm/go6afKfJJ6zi3z6F +77zPRuBzLvQ6GMdyJQiINMrSA1X83OXDTmJFTXKHrT8fSOxKtHhcdGWD2gW/KjwsdK808+39Gb aolqfsSgU3UZEALN+9hxJzHYJHghzmOPHGix0J5er1ORmJAiPM7ok1Kmw6PQpqHewVYm7Q1uvmL wXPJgYq/2mNliusOlOX+fijKggkixeWWUeLffZHLdQKz+JbDXDw0PcIx+rEKKxzymDClOdm3/cL NBInIxbAvInZROc5yIsk48LTZVMHeU2QApYNDS/DZ1FP3lsSzGzqQfqg852xxESi23gYi4cudA= = X-Received: by 2002:adf:9d1c:: with SMTP id k28-v6mr39248627wre.104.1537536409620; Fri, 21 Sep 2018 06:26:49 -0700 (PDT) X-Received: by 2002:adf:9d1c:: with SMTP id k28-v6mr39248574wre.104.1537536408861; Fri, 21 Sep 2018 06:26:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537536408; cv=none; d=google.com; s=arc-20160816; b=b1nI57kF9oCfQOgRwobOYSNfDCgXCMdteystiUKBU5vDTa0Emin/8T07RrhXfIcpjx Gj54jNpTlzSMu0TRZv5HPzM+kzEJZsQ0DaJeFiGEWqcLATGrlC/kqcq8Rg7wv+YvjSTl etPHLWMwPXAwTOlX+8/tkFeAWGuvSCe97yKAL1rEETAJJB6LoJGqAfVxsnh+ceKITMQL HY43Hs+DN3if45eive/ihNGp+VTjziUcjFHm/DMf7or6PQctJHxUHXs3uwVpTPJOmAeX dRNJK/gPOSvhCSUCY8we1iDRuD7P4XsdGFAXfbdHYoWDsgkzEBIH+iTOKfADOnorFEob yVhw== 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=Qxl2mXI3o+wV6JwzDlazHiKHGPEuy6rtVwzXjk1okdE=; b=bm2iQ0ilWUFgYD5RN9LA0XSPw0tSOIJtcsGN7pZ5HNuV/dJwC6uXAmPYtLMsmhLSKP OeRrXJVjKYXJZrhvyjffYPkwILbkW35ckJsMyWUDpCS1s8+dQohPxvVZ///n2MeH6EFo rHKPVAEvr1UWcm539tPYmiYoNuiWFNFPdGEKANSL5/b37t//eKvC3W2oGbIvW6I5sUro bUDk5zqZcX3GDaYw+5iOKvEoLaTI6Ott01Do1BpAIxSI0y+46mQWwboZMjcBKz9QJG3j YTHKfStnNCePhkyubS9mrsfHIAMiU5T31GugtshQNDbb3C237pHqFUFPyRVKVsIevfKR koeA== 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 143-v6sor4139853wmb.14.2018.09.21.06.26.48 for (Google Transport Security); Fri, 21 Sep 2018 06:26:48 -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: ANB0VdYJqGQbcR5DVFKfPLIbcC0Qyje79CqbHhvieO3dVpxWazGjanFWB/C4Azg2y2ezAqVxUyaVHw== 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> 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,