From patchwork Thu Mar 11 08:18:17 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Huang, Ying" X-Patchwork-Id: 12130591 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9EE9CC433E6 for ; Thu, 11 Mar 2021 08:19:20 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 2323864FC4 for ; Thu, 11 Mar 2021 08:19:20 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2323864FC4 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=intel.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 9E2668D0282; Thu, 11 Mar 2021 03:19:19 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 991248D0250; Thu, 11 Mar 2021 03:19:19 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 7E7068D0282; Thu, 11 Mar 2021 03:19:19 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0059.hostedemail.com [216.40.44.59]) by kanga.kvack.org (Postfix) with ESMTP id 663708D0250 for ; Thu, 11 Mar 2021 03:19:19 -0500 (EST) Received: from smtpin03.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 1ADD71730867 for ; Thu, 11 Mar 2021 08:19:19 +0000 (UTC) X-FDA: 77906893638.03.EE4E2DD Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by imf16.hostedemail.com (Postfix) with ESMTP id AEA738019146 for ; Thu, 11 Mar 2021 08:19:16 +0000 (UTC) IronPort-SDR: Q8YA7VqEDzw9d3p5q6dfthi8l8Uqeb2JNI6cDKpDF5Oo8RsUdvDdEcKWNx/33Phk5ad/1OZUeh Fz+U36/TICzQ== X-IronPort-AV: E=McAfee;i="6000,8403,9919"; a="186253548" X-IronPort-AV: E=Sophos;i="5.81,239,1610438400"; d="scan'208";a="186253548" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Mar 2021 00:19:16 -0800 IronPort-SDR: ERncwRO8zMBytZG+JnMFW67NHXDyQpV9ccqpNLtPULJCvp9OERVHVtz7Sgph2lrLiC31YTgxCe MNf9C4adG45A== X-IronPort-AV: E=Sophos;i="5.81,239,1610438400"; d="scan'208";a="410527530" Received: from yhuang6-mobl1.sh.intel.com ([10.238.6.89]) by orsmga008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Mar 2021 00:19:13 -0800 From: Huang Ying To: Peter Zijlstra Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, Huang Ying , Andrew Morton , Michal Hocko , Rik van Riel , Mel Gorman , Ingo Molnar , Dave Hansen , Dan Williams Subject: [RFC -V6 2/6] memory tiering: add page promotion counter Date: Thu, 11 Mar 2021 16:18:17 +0800 Message-Id: <20210311081821.138467-3-ying.huang@intel.com> X-Mailer: git-send-email 2.30.1 In-Reply-To: <20210311081821.138467-1-ying.huang@intel.com> References: <20210311081821.138467-1-ying.huang@intel.com> MIME-Version: 1.0 X-Stat-Signature: rzoy3m1tg1ib9y8s78dgod58yfskk1bk X-Rspamd-Server: rspam01 X-Rspamd-Queue-Id: AEA738019146 Received-SPF: none (intel.com>: No applicable sender policy available) receiver=imf16; identity=mailfrom; envelope-from=""; helo=mga04.intel.com; client-ip=192.55.52.120 X-HE-DKIM-Result: none/none X-HE-Tag: 1615450756-308881 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: To distinguish the number of the memory tiering promoted pages from that of the originally inter-socket NUMA balancing migrated pages. The counter is per-node (count in the target node). So this can be used to identify promotion imbalance among the NUMA nodes. Signed-off-by: "Huang, Ying" Cc: Andrew Morton Cc: Michal Hocko Cc: Rik van Riel Cc: Mel Gorman Cc: Peter Zijlstra Cc: Ingo Molnar Cc: Dave Hansen Cc: Dan Williams Cc: linux-kernel@vger.kernel.org Cc: linux-mm@kvack.org --- include/linux/mmzone.h | 3 +++ include/linux/node.h | 5 +++++ mm/migrate.c | 10 +++++++++- mm/vmstat.c | 3 +++ 4 files changed, 20 insertions(+), 1 deletion(-) diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h index b593316bff3d..42daca801c7f 100644 --- a/include/linux/mmzone.h +++ b/include/linux/mmzone.h @@ -206,6 +206,9 @@ enum node_stat_item { NR_KERNEL_SCS_KB, /* measured in KiB */ #endif NR_PAGETABLE, /* used for pagetables */ +#ifdef CONFIG_NUMA_BALANCING + PGPROMOTE_SUCCESS, /* promote successfully */ +#endif NR_VM_NODE_STAT_ITEMS }; diff --git a/include/linux/node.h b/include/linux/node.h index 8e5a29897936..26e96fcc66af 100644 --- a/include/linux/node.h +++ b/include/linux/node.h @@ -181,4 +181,9 @@ static inline void register_hugetlbfs_with_node(node_registration_func_t reg, #define to_node(device) container_of(device, struct node, dev) +static inline bool node_is_toptier(int node) +{ + return node_state(node, N_CPU); +} + #endif /* _LINUX_NODE_H_ */ diff --git a/mm/migrate.c b/mm/migrate.c index 51c3f203a78f..f434cff9f30e 100644 --- a/mm/migrate.c +++ b/mm/migrate.c @@ -2260,8 +2260,13 @@ int migrate_misplaced_page(struct page *page, struct vm_area_struct *vma, putback_lru_page(page); } isolated = 0; - } else + } else { count_vm_numa_event(NUMA_PAGE_MIGRATE); + if (sysctl_numa_balancing_mode & NUMA_BALANCING_MEMORY_TIERING && + !node_is_toptier(page_to_nid(page)) && node_is_toptier(node)) + mod_node_page_state(NODE_DATA(node), PGPROMOTE_SUCCESS, + nr_succeeded); + } BUG_ON(!list_empty(&migratepages)); return isolated; @@ -2389,6 +2394,9 @@ int migrate_misplaced_transhuge_page(struct mm_struct *mm, mod_node_page_state(page_pgdat(page), NR_ISOLATED_ANON + page_lru, -HPAGE_PMD_NR); + if (!node_is_toptier(page_to_nid(page)) && node_is_toptier(node)) + mod_node_page_state(NODE_DATA(node), PGPROMOTE_SUCCESS, + HPAGE_PMD_NR); return isolated; out_fail: diff --git a/mm/vmstat.c b/mm/vmstat.c index 0450426e7c23..415a31a3a56e 100644 --- a/mm/vmstat.c +++ b/mm/vmstat.c @@ -1215,6 +1215,9 @@ const char * const vmstat_text[] = { "nr_shadow_call_stack", #endif "nr_page_table_pages", +#ifdef CONFIG_NUMA_BALANCING + "pgpromote_success", +#endif /* enum writeback_stat_item counters */ "nr_dirty_threshold",