From patchwork Tue Aug 25 00:23:49 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Huang, Ying" X-Patchwork-Id: 11734493 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 8C144109B for ; Tue, 25 Aug 2020 00:24:41 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 631FE2074D for ; Tue, 25 Aug 2020 00:24:41 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 631FE2074D 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 4A3446B000E; Mon, 24 Aug 2020 20:24:40 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 4564A8D0003; Mon, 24 Aug 2020 20:24:40 -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 3433B6B0022; Mon, 24 Aug 2020 20:24:40 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0204.hostedemail.com [216.40.44.204]) by kanga.kvack.org (Postfix) with ESMTP id 1EA7F6B000E for ; Mon, 24 Aug 2020 20:24:40 -0400 (EDT) Received: from smtpin11.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id DA6FA1EE6 for ; Tue, 25 Aug 2020 00:24:39 +0000 (UTC) X-FDA: 77187195078.11.talk06_4909aa527057 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin11.hostedemail.com (Postfix) with ESMTP id B4254180F8B82 for ; Tue, 25 Aug 2020 00:24:39 +0000 (UTC) X-Spam-Summary: 1,0,0,,d41d8cd98f00b204,ying.huang@intel.com,,RULES_HIT:30003:30012:30054:30055:30064:30070,0,RBL:134.134.136.20:@intel.com:.lbl8.mailshell.net-64.95.201.95 62.50.0.100;04y8wttn4s7brtz7sqmecz3ou9qk6yctzaonuswggtos7hj3kx54kims9x4qcuf.js8ysj1re6rg7ia91c1r86r1qwn8g1hk81ytr1k9jy8h9ysjfnseo1636p6n5o3.c-lbl8.mailshell.net-223.238.255.100,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:ft,MSBL:0,DNSBL:neutral,Custom_rules:0:0:0,LFtime:25,LUA_SUMMARY:none X-HE-Tag: talk06_4909aa527057 X-Filterd-Recvd-Size: 5546 Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by imf07.hostedemail.com (Postfix) with ESMTP for ; Tue, 25 Aug 2020 00:24:38 +0000 (UTC) IronPort-SDR: vAzkA9z7bf4Dr84MlMTDI2gOvfe9au302DsZycplXQm0OD7xK6hIY2fQ8RqZ09sxaDltqtskBk BZ+6WK7JA9aw== X-IronPort-AV: E=McAfee;i="6000,8403,9723"; a="143794280" X-IronPort-AV: E=Sophos;i="5.76,350,1592895600"; d="scan'208";a="143794280" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Aug 2020 17:24:36 -0700 IronPort-SDR: LjKCBR1dPFPixBRn6x2vJZPMplf1nG3kP2MUaOo55PYSdn+C9zH5iFZLAc3TXDu+VA1R8KeyXV 0uTf/+QetoQg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.76,350,1592895600"; d="scan'208";a="443428027" Received: from huiyao-mobl2.ccr.corp.intel.com (HELO yhuang-mobile.ccr.corp.intel.com) ([10.254.214.197]) by orsmga004.jf.intel.com with ESMTP; 24 Aug 2020 17:24:32 -0700 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 -V3 0/5] autonuma: Optimize memory placement for memory tiering system Date: Tue, 25 Aug 2020 08:23:49 +0800 Message-Id: <20200825002354.17038-1-ying.huang@intel.com> X-Mailer: git-send-email 2.28.0 MIME-Version: 1.0 X-Rspamd-Queue-Id: B4254180F8B82 X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam03 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: With the advent of various new memory types, some machines will have multiple types of memory, e.g. DRAM and PMEM (persistent memory). The memory subsystem of these machines can be called memory tiering system, because the performance of the different types of memory are usually different. After commit c221c0b0308f ("device-dax: "Hotplug" persistent memory for use like normal RAM"), the PMEM could be used as the cost-effective volatile memory in separate NUMA nodes. In a typical memory tiering system, there are CPUs, DRAM and PMEM in each physical NUMA node. The CPUs and the DRAM will be put in one logical node, while the PMEM will be put in another (faked) logical node. To optimize the system overall performance, the hot pages should be placed in DRAM node. To do that, we need to identify the hot pages in the PMEM node and migrate them to DRAM node via NUMA migration. In the original AutoNUMA, there are already a set of existing mechanisms to identify the pages recently accessed by the CPUs in a node and migrate the pages to the node. So we can reuse these mechanisms to build the mechanisms to optimize the page placement in the memory tiering system. This has been implemented in this patchset. At the other hand, the cold pages should be placed in PMEM node. So, we also need to identify the cold pages in the DRAM node and migrate them to PMEM node. In the following patchset, [RFC][PATCH 0/9] [v3] Migrate Pages in lieu of discard https://lkml.kernel.org/lkml/20200818184122.29C415DF@viggo.jf.intel.com/ A mechanism to demote the cold DRAM pages to PMEM node under memory pressure is implemented. Based on that, the cold DRAM pages can be demoted to PMEM node proactively to free some memory space on DRAM node. And this frees the space on DRAM node for the hot PMEM pages to be promoted to. This has been implemented in this patchset too. The patchset is based on the following not-yet-merged patchset, [RFC][PATCH 0/9] [v3] Migrate Pages in lieu of discard https://lkml.kernel.org/lkml/20200818184122.29C415DF@viggo.jf.intel.com/ This is part of a larger patch set. If you want to apply these or play with them, I'd suggest using the tree from below, https://github.com/hying-caritas/linux/commits/autonuma-r3 We have tested the solution with the pmbench memory accessing benchmark with the 80:20 read/write ratio and the normal access address distribution on a 2 socket Intel server with Optane DC Persistent Memory Model. The test results of the base kernel and step by step optimizations are as follows, Throughput Promotion DRAM bandwidth access/s MB/s MB/s ----------- ---------- -------------- Base 63868367.1 3626.7 Patch 1 137611105.1 353.5 8608.5 Patch 2 136124113.3 351.8 8480.7 Patch 3 160166665.7 208.2 9407.8 Patch 4 158461356.4 105.3 8790.0 Patch 5 163254205.3 73.6 8800.2 The whole patchset improves the benchmark score up to 155.6%. The basic AutoNUMA based optimization solution, the hot page selection algorithm, and the threshold automatic adjustment algorithms improves the performance or reduce the overhead (promotion MB/s) mostly. Changelog: v3: - Move the rate limit control as late as possible per Mel Gorman's comments. - Revise the hot page selection implementation to store page scan time in struct page. - Code cleanup. - Rebased on the latest page demotion patchset. v2: - Addressed comments for V1. - Rebased on v5.5. Best Regards, Huang, Ying