From patchwork Sun Dec 12 11:32:00 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Baolin Wang X-Patchwork-Id: 12672221 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 037A3C433EF for ; Sun, 12 Dec 2021 11:34:03 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id CCBDF6B0075; Sun, 12 Dec 2021 06:32:34 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id C7BB76B0078; Sun, 12 Dec 2021 06:32:34 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B6A9C6B007B; Sun, 12 Dec 2021 06:32:34 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0063.hostedemail.com [216.40.44.63]) by kanga.kvack.org (Postfix) with ESMTP id A450F6B0075 for ; Sun, 12 Dec 2021 06:32:34 -0500 (EST) Received: from smtpin31.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 4E16682499B9 for ; Sun, 12 Dec 2021 11:32:24 +0000 (UTC) X-FDA: 78908929008.31.1F6DB12 Received: from out30-57.freemail.mail.aliyun.com (out30-57.freemail.mail.aliyun.com [115.124.30.57]) by imf10.hostedemail.com (Postfix) with ESMTP id A14F9C0002 for ; Sun, 12 Dec 2021 11:32:18 +0000 (UTC) X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R111e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e01e04394;MF=baolin.wang@linux.alibaba.com;NM=1;PH=DS;RN=10;SR=0;TI=SMTPD_---0V-JXZHb_1639308733; Received: from localhost(mailfrom:baolin.wang@linux.alibaba.com fp:SMTPD_---0V-JXZHb_1639308733) by smtp.aliyun-inc.com(127.0.0.1); Sun, 12 Dec 2021 19:32:14 +0800 From: Baolin Wang 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 Message-Id: X-Mailer: git-send-email 1.8.3.1 In-Reply-To: References: In-Reply-To: References: Authentication-Results: imf10.hostedemail.com; dkim=none; spf=pass (imf10.hostedemail.com: domain of baolin.wang@linux.alibaba.com designates 115.124.30.57 as permitted sender) smtp.mailfrom=baolin.wang@linux.alibaba.com; dmarc=pass (policy=none) header.from=alibaba.com X-Rspamd-Server: rspam08 X-Rspamd-Queue-Id: A14F9C0002 X-Stat-Signature: mp18jg33z4g9ce1r3e588narxuoi71xf X-HE-Tag: 1639308738-309235 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 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 --- 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) {