Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp669690imm; Fri, 21 Sep 2018 06:28:19 -0700 (PDT) X-Google-Smtp-Source: ANB0VdZDelMN9nceJzds1ELPSEfX7fZk0J04zxYg0mCaINqKGd98HJxIR86GFMLIuCgiq8sNfS/M X-Received: by 2002:a63:4606:: with SMTP id t6-v6mr41354110pga.271.1537536499158; Fri, 21 Sep 2018 06:28:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537536499; cv=none; d=google.com; s=arc-20160816; b=ks1qMjEU+kLznaRCnA0VKOaZ6t7VYUonr4x5SZT9VNR57WvjiJ1L6rqlq8g+3MvWoJ vy+u727/dUhQLzIaX0VK6aH6KerWZEyTeelD/HiVOcaeZPPycIujQ01bC3/WyDqf8Q4h SzdV2GZahZRZWDqJqpVPpsJ5BHjP5Ji+gmSuSiuotaWr5KIian8QvrDGf0EsJJsglBSy CS00d8iphqDy741PKLJO12NP/li4CTc93m2jjIpe9qIMUM40pDth/jAmBwUuMvREw9+c 1v5uuRCiyN1XbwRsYfDeffhAOqIBLG9TtelZlv1kXRdlpaXCHwdhE1r/eiTL2rv4ieMx h+IQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from; bh=1uKCZtawr6sx1VF67pqvvb8M6Rauyp4CSph0imxJ5Ao=; b=UY/vFk4TU20k78L2MitIhADRe/bO53tDXCTLRNXH6Rrn1ECXgvaBo0vH9moc7a2qha Ru7z/Cg3TTs89XJHC78fKZrtJ83BNj1sU2HFbe3HfCvO/xbqK6S61ibHs8viAqpFNaCp xNn+u4Nz8nlFI1Lv4o5aRfLFRWlj/RilqEUvsH4z28rLIYRTIU7RwZccyokcvMCtT5s4 H631yNOLXcJ2CFAgDNPp6lvfJUUcgJ8tXLFqbY8XTvTYSgDcZfsIT7tJsEZZIdj4Wxy4 NgDZbgAGUCZKPzZr3p+p2IDimgkkmYgjLJLuQr4TxjVhb9kormh8xeRGLn1U1w2S7G5C eEqA== 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 e1-v6si27388473pld.408.2018.09.21.06.27.47; Fri, 21 Sep 2018 06:28:19 -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 S2390082AbeIUTPe (ORCPT + 99 others); Fri, 21 Sep 2018 15:15:34 -0400 Received: from mail-wr1-f50.google.com ([209.85.221.50]:45095 "EHLO mail-wr1-f50.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727554AbeIUTPe (ORCPT ); Fri, 21 Sep 2018 15:15:34 -0400 Received: by mail-wr1-f50.google.com with SMTP id 20-v6so12854605wrb.12 for ; Fri, 21 Sep 2018 06:26:42 -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; bh=1uKCZtawr6sx1VF67pqvvb8M6Rauyp4CSph0imxJ5Ao=; b=jYXQ8VGvFfkKCmOwm3UpDrMMpnwU7qZ0MSfdpPFlQ2EjpWQdenjGCpUrHSQ+9j9kqK /WxFRSTpHGS1aiWygeK0yZWHWtYEEW8LTAw7WbQlDiManHEPJWEV7EHBy0NUWEPbTXHt Z3p5SE5DkZ5jJjrdVVznWNQ4hkSmx7aYhIFecSUoLpgv7wPpoy6m/Rbe13QpeHrVmK6L NN7jfVTMkQ8TI2ggM7bUuJJ0zkH9s+bZFdGM7gJHY+bmWW5sDnPHslung+aRHmgop5s/ XQbJf6sWl2eGFFgwCEwNYA/6Q6NNAl33A92JqSZZAalVM8HCtqi4zby+tXlNf0rAkL4R mKiQ== X-Gm-Message-State: APzg51CmXCSWHbE6PqLAedISgCVnZKjF7rgBpblqpSCTG/ihU5+8WoXP VetlCpKxc8hA0Qlu3F4Z0rE= X-Received: by 2002:adf:e44e:: with SMTP id t14-v6mr37268082wrm.96.1537536401315; 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 y5-v6sm30937834wrd.5.2018.09.21.06.26.40 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 21 Sep 2018 06:26:40 -0700 (PDT) Received: from d104.suse.de (nat.nue.novell.com [195.135.221.2]) by techadventures.net (Postfix) with ESMTPA id C3A0D1252A7; Fri, 21 Sep 2018 15:26:39 +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 0/4] Refactor node_states_check_changes_online/offline Date: Fri, 21 Sep 2018 15:26:30 +0200 Message-Id: <20180921132634.10103-1-osalvador@techadventures.net> X-Mailer: git-send-email 2.13.6 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Oscar Salvador v1 -> v2: - Address feedback from Pavel - Re-write patch4 his way, as it is better - Add Reviewed-by from Pavel --- This patchset refactors/clean ups node_states_check_changes_online/offline functions together with node_states_set/clear_node. The main reason behind this patchset is that currently, these functions are suboptimal and confusing. For example, they contain wrong statements like: if (N_MEMORY == N_NORMAL_MEMORY) if (N_MEMORY =! N_NORMAL_MEMORY) if (N_MEMORY != N_HIGH_MEMORY) if (N_MEMORY == N_HIGH_MEMORY) These comparasions are wrong, as N_MEMORY will never be equal to either N_NORMAL_MEMORY or N_HIGH_MEMORY. Although the statements do not "affect" the flow because in the way they are placed, they are completely wrong and confusing. I caught another misuse of this in [1]. Another thing that this patchset addresses is the fact that some functions get called twice, or even unconditionally, without any need. Examples of this are: - node_states_set_node()->node_set_state(node, N_MEMORY) * node_states_set_node() gets called whenever we online pages, so we end up calling node_set_state(node, N_MEMORY) everytime. To avoid this, we should check if the node is already in node_state[N_MEMORY]. - node_states_set_node()->node_set_state(node, N_HIGH_MEMORY) * On !CONFIG_HIGH_MEMORY, N_HIGH_MEMORY == N_NORMAL_MEMORY, but the current code sets: status_change_nid_high = status_change_nid_normal This means that we will call node_set_state(node, N_NORMAL_MEMORY) twice. The fix here is to set status_change_nid_normal = -1 on such systems, so we skip the second call. [1] https://patchwork.kernel.org/patch/10579155/ Oscar Salvador (4): mm/memory_hotplug: Spare unnecessary calls to node_set_state mm/memory_hotplug: Tidy up node_states_clear_node mm/memory_hotplug: Simplify node_states_check_changes_online mm/memory_hotplug: Clean up node_states_check_changes_offline mm/memory_hotplug.c | 146 ++++++++++++++-------------------------------------- 1 file changed, 40 insertions(+), 106 deletions(-) -- 2.13.6