Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp2150514pxb; Sun, 30 Jan 2022 06:41:34 -0800 (PST) X-Google-Smtp-Source: ABdhPJxxVZcdTRgisYwlB9Z/K/lL/8nk6i0Z69KiducNE6saUPVkc0V/lWHKqswvBK9QT9hQEPK4 X-Received: by 2002:a17:90a:4b8b:: with SMTP id i11mr29724974pjh.148.1643553694603; Sun, 30 Jan 2022 06:41:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643553694; cv=none; d=google.com; s=arc-20160816; b=Ob+S/JBQHJdC2a/tR/nW21M8ltTjAjjri+sRrWajIDF75+COclyK7bFD9wCuxzj0LB lxmjnMz5NK7f5GasRO1vazLR4f9xFygUKbvJbpXJXtXlzY9EoG+8m3b4WZKRvWsbBqXP F6M8Ydul3T7CVGilwL45ZKJ46evHI4+nEOdKnJ3krkpd876BvqpIZ7k/Q0dAdhCXvR63 Rfra4dZpdivi0IFNViNkWMSy3vCqSRXyZBLvePStoG9CII0mY59I8dhTI+7ifjBVWsLA Z7ATr+f7am7nvebXs9z7bVvLYddHOIv9i3AWj9NDB3WdwupJcDREtb2+7Gkg0+MCMZg2 40Eg== 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:dkim-signature; bh=ly1qG8j+QwSuAlCZoVl3xPgU3LL6lVBhaq4CZfTvO1M=; b=gCRgBR1KFbvHsIqr5KXLdAzUbNO7coDGcvj5xGZvBUAiIQhhDFRlRdDA4h0mXVw3Kd u7hdnuA2fXBohx8FClOD7mBtdPSnpGyRv/ZttQ8KSvZnEWdHbY140ZZSbp28bBUgxY5S egRvf31sKEPTD8X4SeipyUaSDHBSndg81In8YW4dqgotGUHOpkAiA7EIbdgNVyaus9Hu CMXv+m7qSSOJQKSP/+ipuNsrjsA5RT6Ouaci6ujj//tMR96VMMBjplkBOk08bUXjXFMR 34jrXbytj5VLOjegTNdJ9kL9zjiMe1PmOnJoyjPB4am02EmJ6ii+NNv/jGY6/5TUTQ+b kftQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=WDMQ+w77; 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=pass (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 g191si11152346pgc.494.2022.01.30.06.41.23; Sun, 30 Jan 2022 06:41:34 -0800 (PST) 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; dkim=pass header.i=@intel.com header.s=Intel header.b=WDMQ+w77; 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=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347271AbiA1I2J (ORCPT + 99 others); Fri, 28 Jan 2022 03:28:09 -0500 Received: from mga01.intel.com ([192.55.52.88]:54784 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347139AbiA1I2I (ORCPT ); Fri, 28 Jan 2022 03:28:08 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1643358488; x=1674894488; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=0yiNsJ1tR7PSgwRrBaP+3x76s+wLRvU9DacOc8key2s=; b=WDMQ+w77m2G2m+H5gtxt96zO/9DVaBhrIeDjBzc6x0QTJjvZAneKBS8i fGsR4jDAIgZrvE9gsfKVbLMxR3pV+2ernncFFG5jb+Ozzratt7znyZkmy 17dYcBovZJCEXJaBpahwOGD/R6ooB3Qd2RYWmv2G8E7P6/MEU+aZlhXU2 X9t6SCfZWxFHkA1LeIuJ8vydXEqXB1W49m5QpWaCwoc2j0QQAEWK/pFFF D6ruHuW5IG4eY16HWjkiRtzQpD41YsUPo5rKbnYPnFSueh3dPuXUk71l+ P8iv397sjLkMNxUu0IPWhOdyKdD8oy9dYSDcrEMhTo//X9rhlHzEVwY8f Q==; X-IronPort-AV: E=McAfee;i="6200,9189,10240"; a="271537168" X-IronPort-AV: E=Sophos;i="5.88,323,1635231600"; d="scan'208";a="271537168" Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 Jan 2022 00:28:08 -0800 X-IronPort-AV: E=Sophos;i="5.88,323,1635231600"; d="scan'208";a="697019586" Received: from yhuang6-desk2.sh.intel.com ([10.239.13.11]) by orsmga005-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 Jan 2022 00:28:04 -0800 From: Huang Ying To: Peter Zijlstra , Mel Gorman Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, Feng Tang , Huang Ying , Andrew Morton , Michal Hocko , Rik van Riel , Mel Gorman , Dave Hansen , Yang Shi , Zi Yan , Wei Xu , osalvador , Shakeel Butt , Hasan Al Maruf Subject: [PATCH -V11 0/3] NUMA balancing: optimize memory placement for memory tiering system Date: Fri, 28 Jan 2022 16:27:48 +0800 Message-Id: <20220128082751.593478-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 v5.17-rc1 - Remove [4-6] from the original patchset to make it easier to be reviewed. - Change the additional promotion watermark to be the high watermark / 4. -- 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 Gauss access address distribution on a 2 socket Intel server with Optane DC Persistent Memory Model. The test results shows that the pmbench score can improve up to 95.9%. Changelog: v11: - Rebased on v5.17-rc1 - Remove [4-6] from the original patchset to make it easier to be reviewed. - Change the additional promotion watermark to be the high watermark / 4. v10: - Rebased on v5.16-rc1 - Revise error processing for [1/6] (promotion counter) per Yang's comments - Add sysctl document for [2/6] (optimize page placement) - Reset threshold adjustment state when disable/enable tiering mode - Reset threshold when workload transition is detected. v9: - Rebased on v5.15-rc4 - Make "add promotion counter" the first patch per Yang's comments v8: - Rebased on 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