Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp259650pxb; Mon, 13 Sep 2021 18:39:03 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyQYkZY3t0tOmwJrqZIodYUnyxCZxmJ9Cd3ZvwmgoLScdkcNlxAX/MFP0b2nvKDhEp3xv38 X-Received: by 2002:a05:6402:430f:: with SMTP id m15mr16255855edc.115.1631583543127; Mon, 13 Sep 2021 18:39:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631583543; cv=none; d=google.com; s=arc-20160816; b=tT60hPTzGa8EBI/cpkpeFSpNcyCATVXuBO73hN/541hyL+wCUparpdLk0V538mlKKN ltMy+RdZFqvTIS/lXrngtECMaP1lCoLGOt4p/pgF2U3Sn71iCg739KGdUiwpcZBOn1EC 9z1YZT3mcHPLTjFR2Hswq2A6ieuOl/zQyZbhg2U15ZVrjyBE6KB2guYz5gPxME7F4L+A vRw1QJA5X8ewinpmhF5Omhh5w4WeAPjEev9rl2LRbMem3zBOU2SJ+q/lea5pvMDXpcfI K62xTdaZowE8TaiL/ba+N9hHIyXu2yxQ8/wnKzyJk0MAQ3zHgt1/u9k9IFpaK0pDSV1C 1r7g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=78Xhv10ps85WqjdMM9GXV1VW4udy7MDYLGg9b7+t1uY=; b=iLsspEwQzp1erpR2haVdN5rOEpNqDPtblm1n4yrFg/z9ofqYwb/+wZbjatPvBk1Wqr PtDUfqfio5Hj5mRm2MO/43Rc2v218xzOUEawXClDPKS41HdZsxOrQ9S30PXnf8sfxKDW u+oDmXMhoFIIlX601SntOLY52FeBQEhKQD+biptxGoOPN7aiit8Yxbgtb+PHQ4guCHhq hGYNkgvQAxLkWMdJjseWvcBZUAkPoL6ZDRBKaH/D9EQP0+aYf4KTi/rp699sykkFGezo bmDNQwSNs4FoATME/D51+bX4sykyNkFjIDuKLzleUNZRo/u4YNLVW4KR6S2QFZvuSWYT Sx8Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id j8si8976335ejn.202.2021.09.13.18.38.39; Mon, 13 Sep 2021 18:39:03 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230109AbhINBig (ORCPT + 99 others); Mon, 13 Sep 2021 21:38:36 -0400 Received: from mga05.intel.com ([192.55.52.43]:19808 "EHLO mga05.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229460AbhINBif (ORCPT ); Mon, 13 Sep 2021 21:38:35 -0400 X-IronPort-AV: E=McAfee;i="6200,9189,10106"; a="307395477" X-IronPort-AV: E=Sophos;i="5.85,291,1624345200"; d="scan'208";a="307395477" Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Sep 2021 18:37:18 -0700 X-IronPort-AV: E=Sophos;i="5.85,291,1624345200"; d="scan'208";a="543575247" Received: from yhuang6-desk2.sh.intel.com ([10.239.159.119]) by fmsmga003-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Sep 2021 18:37:14 -0700 From: Huang Ying To: linux-kernel@vger.kernel.org Cc: Huang Ying , Andrew Morton , Michal Hocko , Rik van Riel , Mel Gorman , Peter Zijlstra , Dave Hansen , Yang Shi , Zi Yan , Wei Xu , osalvador , Shakeel Butt , linux-mm@kvack.org Subject: [PATCH -V8 0/6] NUMA balancing: optimize memory placement for memory tiering system Date: Tue, 14 Sep 2021 09:36:55 +0800 Message-Id: <20210914013701.344956-1-ying.huang@intel.com> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The changes since the last post are as follows, - Rebased on latest upstream kernel (v5.15-rc1) - Make user-specified threshold take effect sooner -- 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 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 NUMA balancing, 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 is 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 commit 26aa2d199d6f ("mm/migrate: demote pages during reclaim"), 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 to accommodate the promoted hot PMEM pages. This is implemented in this patchset too. 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 74238178.0 4291.7 Patch 2 146050652.3 359.4 11248.6 Patch 3 146300787.1 355.2 11237.2 Patch 4 162536383.0 211.7 11890.4 Patch 5 157187775.0 105.9 10412.3 Patch 6 164028415.2 73.3 10810.6 The whole patchset improves the benchmark score up to 119.1%. The basic NUMA balancing based optimization solution (patch 1), the hot page selection algorithm (patch 4), and the threshold automatic adjustment algorithms (patch 6) improves the performance or reduce the overhead (promotion MB/s) greatly. Changelog: v8: - Rebased on latest upstream kernel (v5.15-rc1) - Make user-specified threshold take effect sooner v7: - Rebased on the mmots tree of 2021-07-15. - Some minor fixes. v6: - Rebased on the latest page demotion patchset. (which bases on v5.11) v5: - Rebased on the latest page demotion patchset. (which bases on v5.10) v4: - Rebased on the latest page demotion patchset. (which bases on v5.9-rc6) - Add page promotion counter. 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