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 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id E16B8C433F5 for ; Wed, 27 Apr 2022 03:34:59 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 3BE566B0073; Tue, 26 Apr 2022 23:34:59 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 3718C6B0075; Tue, 26 Apr 2022 23:34:59 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 20F186B0078; Tue, 26 Apr 2022 23:34:59 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (relay.hostedemail.com [64.99.140.26]) by kanga.kvack.org (Postfix) with ESMTP id 0BF0D6B0073 for ; Tue, 26 Apr 2022 23:34:59 -0400 (EDT) Received: from smtpin08.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id CA48628955 for ; Wed, 27 Apr 2022 03:34:58 +0000 (UTC) X-FDA: 79401242676.08.FBEADC6 Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by imf11.hostedemail.com (Postfix) with ESMTP id 58A2D4004A for ; Wed, 27 Apr 2022 03:34:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1651030498; x=1682566498; h=message-id:subject:from:to:cc:date:in-reply-to: references:mime-version:content-transfer-encoding; bh=4kziqPK6l4x/fvzzWWLFecRORja1cSYYYy4cJwdbDVg=; b=b7eQH06U66hsi0+yHP510M5PCsBallpPfrUpQpeHJuwmK14hZnZgxWNh I+aqig1sp2RGvTI3x8JSvzAQRhMKC5+aG7XDEPYLWSeUTJcQxfXDyHQsw +L/CaxXjASy5eGOYHiQumdGBTqdPOXtioBZ4g/8i+3idnaFKhnB5oYAu/ RSZIq+oZJVuTO6Fq0eg9+I4raQy3aqG1voLtImsurl4GQgJFg7xvTH9BC a/kYC3I44SleZ/N//FCJPebQkSL4rv3hjLiwaZdtJ/kxCGgWi1EFn68p5 v7D028IxIeg6dwtubYEMLAodCevFgU3765WQMsOz9pbALqzD5fvL/wA0j w==; X-IronPort-AV: E=McAfee;i="6400,9594,10329"; a="263390706" X-IronPort-AV: E=Sophos;i="5.90,292,1643702400"; d="scan'208";a="263390706" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Apr 2022 20:34:56 -0700 X-IronPort-AV: E=Sophos;i="5.90,292,1643702400"; d="scan'208";a="580336047" Received: from mhuan11-mobl8.ccr.corp.intel.com ([10.254.213.180]) by orsmga008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Apr 2022 20:34:53 -0700 Message-ID: <76be9f84bac12e2283a1414da11ca1d470924ee4.camel@intel.com> Subject: Re: [PATCH v3 0/7] mm: demotion: Introduce new node state N_DEMOTION_TARGETS From: "ying.huang@intel.com" To: Aneesh Kumar K V , Jonathan Cameron , Jagdish Gediya Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, akpm@linux-foundation.org, baolin.wang@linux.alibaba.com, dave.hansen@linux.intel.com, shy828301@gmail.com, weixugc@google.com, gthelen@google.com, dan.j.williams@intel.com Date: Wed, 27 Apr 2022 11:34:51 +0800 In-Reply-To: <4a9eaf06-294c-032d-9b85-14c1d91fb732@linux.ibm.com> References: <20220422195516.10769-1-jvgediya@linux.ibm.com> <4b986b46afb2fe888c127d8758221d0f0d3ec55f.camel@intel.com> <20220425145735.000007ca@Huawei.com> <8a8d14ca-0976-41cc-02cb-dd1680fa37ef@linux.ibm.com> <0b2fd48049e8f59fb132f260df9e2a84b58e4577.camel@intel.com> <4a9eaf06-294c-032d-9b85-14c1d91fb732@linux.ibm.com> Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.38.3-1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: 58A2D4004A X-Stat-Signature: 58dbaaxhh79pck7b1rzgz15g3jn5bd3h Authentication-Results: imf11.hostedemail.com; dkim=pass header.d=intel.com header.s=Intel header.b=b7eQH06U; dmarc=pass (policy=none) header.from=intel.com; spf=none (imf11.hostedemail.com: domain of ying.huang@intel.com has no SPF policy when checking 192.55.52.93) smtp.mailfrom=ying.huang@intel.com X-Rspam-User: X-HE-Tag: 1651030495-347631 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: On Wed, 2022-04-27 at 08:27 +0530, Aneesh Kumar K V wrote: > On 4/27/22 6:59 AM, ying.huang@intel.com wrote: > > On Mon, 2022-04-25 at 20:14 +0530, Aneesh Kumar K V wrote: > > > On 4/25/22 7:27 PM, Jonathan Cameron wrote: > > > > On Mon, 25 Apr 2022 16:45:38 +0530 > > > > Jagdish Gediya wrote: > > > > > > > > > On Sun, Apr 24, 2022 at 11:19:53AM +0800, ying.huang@intel.com wrote: > > > > > > On Sat, 2022-04-23 at 01:25 +0530, Jagdish Gediya wrote: > > > > > > > Some systems(e.g. PowerVM) can have both DRAM(fast memory) only > > > > > > > NUMA node which are N_MEMORY and slow memory(persistent memory) > > > > > > > only NUMA node which are also N_MEMORY. As the current demotion > > > > > > > target finding algorithm works based on N_MEMORY and best distance, > > > > > > > it will choose DRAM only NUMA node as demotion target instead of > > > > > > > persistent memory node on such systems. If DRAM only NUMA node is > > > > > > > filled with demoted pages then at some point new allocations can > > > > > > > start falling to persistent memory, so basically cold pages are in > > > > > > > fast memor (due to demotion) and new pages are in slow memory, this > > > > > > > is why persistent memory nodes should be utilized for demotion and > > > > > > > dram node should be avoided for demotion so that they can be used > > > > > > > for new allocations. > > > > > > > > > > > > > > Current implementation can work fine on the system where the memory > > > > > > > only numa nodes are possible only for persistent/slow memory but it > > > > > > > is not suitable for the like of systems mentioned above. > > > > > > > > > > > > Can you share the NUMA topology information of your machine? And the > > > > > > demotion order before and after your change? > > > > > > > > > > > > Whether it's good to use the PMEM nodes as the demotion targets of the > > > > > > DRAM-only node too? > > > > > > > > > > $ numactl -H > > > > > available: 2 nodes (0-1) > > > > > node 0 cpus: 0 1 2 3 4 5 6 7 > > > > > node 0 size: 14272 MB > > > > > node 0 free: 13392 MB > > > > > node 1 cpus: > > > > > node 1 size: 2028 MB > > > > > node 1 free: 1971 MB > > > > > node distances: > > > > > node 0 1 > > > > >     0: 10 40 > > > > >     1: 40 10 > > > > > > > > > > 1) without N_DEMOTION_TARGETS patch series, 1 is demotion target > > > > >      for 0 even when 1 is DRAM node and there is no demotion targets for 1. > > > > > > > > I'm not convinced the distinction between DRAM and persistent memory is > > > > valid. There will definitely be systems with a large pool > > > > of remote DRAM (and potentially no NV memory) where the right choice > > > > is to demote to that DRAM pool. > > > > > > > > Basing the decision on whether the memory is from kmem or > > > > normal DRAM doesn't provide sufficient information to make the decision. > > > > > > > > > > Hence the suggestion for the ability to override this from userspace. > > > Now, for example, we could build a system with memory from the remote > > > machine (memory inception in case of power which will mostly be plugged > > > in as regular hotpluggable memory ) and a slow CXL memory or OpenCAPI > > > memory. > > > > > > In the former case, we won't consider that for demotion with this series > > > because that is not instantiated via dax kmem. So yes definitely we > > > would need the ability to override this from userspace so that we could > > > put these remote memory NUMA nodes as demotion targets if we want. > > > > > > > > > Is there a driver for the device (memory from the remote machine)? If > > so, we can adjust demotion order for it in the driver. > > > > At this point, it is managed by hypervisor, is hotplugged into the the > LPAR with more additional properties specified via device tree. So there > is no inception specific device driver. Because there's information in device tree, I still think it's doable in the kernel. But it's up to you to choose the appropriate way. Best Regards, Huang, Ying > > In general, I think that we can adjust demotion order inside kernel from > > various information sources. In addition to ACPI SLIT, we also have > > HMAT, kmem driver, other drivers, etc. > > > > Managing inception memory will any way requires a userspace component to > track the owner machine for the remote memory. So we should be ok to > have userspace manage demotion order. > > -aneesh >