From mboxrd@z Thu Jan 1 00:00:00 1970 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=-3.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED autolearn=no 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 8397DC636CA for ; Fri, 16 Jul 2021 03:32:19 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 22A81613E6 for ; Fri, 16 Jul 2021 03:32:19 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 22A81613E6 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 7C8868D00F4; Thu, 15 Jul 2021 23:32:19 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 7785A8D00EC; Thu, 15 Jul 2021 23:32:19 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 618FE8D00F4; Thu, 15 Jul 2021 23:32:19 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 35BD88D00EC for ; Thu, 15 Jul 2021 23:32:19 -0400 (EDT) Received: from smtpin36.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 0955B1853BBF6 for ; Fri, 16 Jul 2021 03:32:18 +0000 (UTC) X-FDA: 78367027956.36.BAF92E8 Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by imf08.hostedemail.com (Postfix) with ESMTP id 0730330000AA for ; Fri, 16 Jul 2021 03:32:16 +0000 (UTC) X-IronPort-AV: E=McAfee;i="6200,9189,10046"; a="208850823" X-IronPort-AV: E=Sophos;i="5.84,244,1620716400"; d="scan'208";a="208850823" Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Jul 2021 20:32:14 -0700 X-IronPort-AV: E=Sophos;i="5.84,244,1620716400"; d="scan'208";a="495779552" Received: from yhuang6-desk2.sh.intel.com (HELO yhuang6-desk2.ccr.corp.intel.com) ([10.239.159.119]) by fmsmga003-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Jul 2021 20:32:10 -0700 From: "Huang, Ying" To: Andrew Morton Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, Dave Hansen , yang.shi@linux.alibaba.com, rientjes@google.com, dan.j.williams@intel.com, david@redhat.com, osalvador@suse.de, weixugc@google.com, Michal Hocko , Yang Shi , Zi Yan Subject: Re: [PATCH -V10 0/9] Migrate Pages in lieu of discard References: <20210715055145.195411-1-ying.huang@intel.com> <20210715123836.ad76b0a2e29c0bbd3cd67767@linux-foundation.org> Date: Fri, 16 Jul 2021 11:32:09 +0800 In-Reply-To: <20210715123836.ad76b0a2e29c0bbd3cd67767@linux-foundation.org> (Andrew Morton's message of "Thu, 15 Jul 2021 12:38:36 -0700") Message-ID: <87k0lrndc6.fsf@yhuang6-desk2.ccr.corp.intel.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=ascii Authentication-Results: imf08.hostedemail.com; dkim=none; dmarc=fail reason="No valid SPF, No valid DKIM" header.from=intel.com (policy=none); spf=none (imf08.hostedemail.com: domain of ying.huang@intel.com has no SPF policy when checking 192.55.52.120) smtp.mailfrom=ying.huang@intel.com X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: 0730330000AA X-Stat-Signature: edt1ob9imctoq89zattakpyy6339oknk X-HE-Tag: 1626406336-665450 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: Andrew Morton writes: > On Thu, 15 Jul 2021 13:51:36 +0800 Huang Ying wrote: > > The [0/n] description talks a lot about PMEM, but the patches > themselves are all about NUMA nodes. I assume that what ties this > together is that the PMEM tends to be organized as a NUMA node on its > own, and that by enabling migrate-to-remote-node-during-reclaim, we get > this PMEM behaviour as a desired side-effect? > > IOW, perhaps this [0/n] description could explain the linkage between > PMEM and NUMA nodes more explicitly. Hi, Andrew, I have added some words in the [0/9] description to link PMEM and NUMA nodes. The updated description is as below. Can you take a look at it? Best Regards, Huang, Ying --------------------------8<----------------------------------- We're starting to see systems with more and more kinds of memory such as Intel's implementation of persistent memory. Let's say you have a system with some DRAM and some persistent memory. Today, once DRAM fills up, reclaim will start and some of the DRAM contents will be thrown out. Allocations will, at some point, start falling over to the slower persistent memory. That has two nasty properties. First, the newer allocations can end up in the slower persistent memory. Second, reclaimed data in DRAM are just discarded even if there are gobs of space in persistent memory that could be used. This patchset implements a solution to these problems. At the end of the reclaim process in shrink_page_list() just before the last page refcount is dropped, the page is migrated to persistent memory instead of being dropped. While I've talked about a DRAM/PMEM pairing, this approach would function in any environment where memory tiers exist. This is not perfect. It "strands" pages in slower memory and never brings them back to fast DRAM. Huang Ying has follow-on work which repurposes autonuma to promote hot pages back to DRAM. This is also all based on an upstream mechanism that allows persistent memory to be onlined and used as if it were volatile: http://lkml.kernel.org/r/20190124231441.37A4A305@viggo.jf.intel.com With that, the DRAM and PMEM in each socket will be represented as 2 separate NUMA nodes, with the CPUs sit in the DRAM node. So the general inter-NUMA demotion mechanism introduced in the patchset can migrate the cold DRAM pages to the PMEM node. We have tested the patchset with the postgresql and pgbench. On a 2-socket server machine with DRAM and PMEM, the kernel with the patchset can improve the score of pgbench up to 22.1% compared with that of the DRAM only + disk case. This comes from the reduced disk read throughput (which reduces up to 70.8%). == Open Issues == * Memory policies and cpusets that, for instance, restrict allocations to DRAM can be demoted to PMEM whenever they opt in to this new mechanism. A cgroup-level API to opt-in or opt-out of these migrations will likely be required as a follow-on. * Could be more aggressive about where anon LRU scanning occurs since it no longer necessarily involves I/O. get_scan_count() for instance says: "If we have no swap space, do not bother scanning anon pages"