linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Baolin Wang <baolin.wang@linux.alibaba.com>
To: akpm@linux-foundation.org, ying.huang@intel.com,
	dave.hansen@linux.intel.com
Cc: ziy@nvidia.com, shy828301@gmail.com,
	baolin.wang@linux.alibaba.com, zhongjiang-ali@linux.alibaba.com,
	xlpang@linux.alibaba.com, linux-mm@kvack.org,
	linux-kernel@vger.kernel.org
Subject: [RFC PATCH 4/4] mm: Update the speculative pages' accessing time
Date: Sun, 12 Dec 2021 19:32:00 +0800	[thread overview]
Message-ID: <c7d23137cbf56c3b0c81e98e3ed4676ca3e44dea.1639306956.git.baolin.wang@linux.alibaba.com> (raw)
In-Reply-To: <cover.1639306956.git.baolin.wang@linux.alibaba.com>
In-Reply-To: <cover.1639306956.git.baolin.wang@linux.alibaba.com>

On some systems with different memory types, including fast memory (DRAM)
and slow memory (persistent memory), which will rely on the numa balancing
to promote slow and hot memory to fast memory to improve performance.
After supporting the speculative numa fault, we can update the next pages'
accessing time to help to promote it to fast memory node easily to
improve the performance.

Signed-off-by: Baolin Wang <baolin.wang@linux.alibaba.com>
---
 mm/memory.c | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/mm/memory.c b/mm/memory.c
index 91122beb6e53..e19b10299913 100644
--- a/mm/memory.c
+++ b/mm/memory.c
@@ -4556,10 +4556,21 @@ static vm_fault_t do_numa_page(struct vm_fault *vmf)
 	 * to record page access time.  So use default value.
 	 */
 	if ((sysctl_numa_balancing_mode & NUMA_BALANCING_MEMORY_TIERING) &&
-	    !node_is_toptier(page_nid))
+	    !node_is_toptier(page_nid)) {
 		last_cpupid = (-1 & LAST_CPUPID_MASK);
-	else
+		/*
+		 * According to the data locality for some workloads, the
+		 * probability of accessing some data soon after some nearby
+		 * data has been accessed. So for tiered memory systems, we
+		 * can update the sequential page's age located on slow memory
+		 * type, to try to promote it to fast memory in advance to
+		 * improve the performance.
+		 */
+		if (vmf->address != fault_address)
+			xchg_page_access_time(page, jiffies_to_msecs(jiffies));
+	} else {
 		last_cpupid = page_cpupid_last(page);
+	}
 	target_nid = numa_migrate_prep(page, vma, fault_address, page_nid,
 			&flags);
 	if (target_nid == NUMA_NO_NODE) {
-- 
2.27.0



      parent reply	other threads:[~2021-12-12 11:34 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-12 11:31 [RFC PATCH 0/4] Add speculative numa fault support Baolin Wang
2021-12-12 11:31 ` [RFC PATCH 1/4] mm: " Baolin Wang
2021-12-12 11:31 ` [RFC PATCH 2/4] mm: Add a debug interface to control the range of speculative numa fault Baolin Wang
2021-12-12 11:31 ` [RFC PATCH 3/4] mm: Add speculative numa fault stats Baolin Wang
2021-12-12 11:32 ` Baolin Wang [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=c7d23137cbf56c3b0c81e98e3ed4676ca3e44dea.1639306956.git.baolin.wang@linux.alibaba.com \
    --to=baolin.wang@linux.alibaba.com \
    --cc=akpm@linux-foundation.org \
    --cc=dave.hansen@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=shy828301@gmail.com \
    --cc=xlpang@linux.alibaba.com \
    --cc=ying.huang@intel.com \
    --cc=zhongjiang-ali@linux.alibaba.com \
    --cc=ziy@nvidia.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox