From patchwork Tue Feb 18 08:26:33 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Huang, Ying" X-Patchwork-Id: 11387993 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 419311580 for ; Tue, 18 Feb 2020 08:27:41 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 18A57206E2 for ; Tue, 18 Feb 2020 08:27:41 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 18A57206E2 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 0D34C6B0010; Tue, 18 Feb 2020 03:27:39 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 0842E6B0032; Tue, 18 Feb 2020 03:27:39 -0500 (EST) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id EDE106B0036; Tue, 18 Feb 2020 03:27:38 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0087.hostedemail.com [216.40.44.87]) by kanga.kvack.org (Postfix) with ESMTP id D4B496B0010 for ; Tue, 18 Feb 2020 03:27:38 -0500 (EST) Received: from smtpin24.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 736EC181AEF1D for ; Tue, 18 Feb 2020 08:27:38 +0000 (UTC) X-FDA: 76502568996.24.bears08_42a6c9c28932c X-Spam-Summary: 1,0,0,,d41d8cd98f00b204,ying.huang@intel.com,:peterz@infradead.org:mingo@kernel.org::linux-kernel@vger.kernel.org:feng.tang@intel.com:ying.huang@intel.com:akpm@linux-foundation.org:mhocko@suse.com:riel@redhat.com:mgorman@suse.de:dave.hansen@linux.intel.com:dan.j.williams@intel.com,RULES_HIT:30003:30054:30064,0,RBL:134.134.136.100:@intel.com:.lbl8.mailshell.net-62.18.0.100 64.95.201.95,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:ft,MSBL:0,DNSBL:none,Custom_rules:0:0:0,LFtime:24,LUA_SUMMARY:none X-HE-Tag: bears08_42a6c9c28932c X-Filterd-Recvd-Size: 3928 Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by imf14.hostedemail.com (Postfix) with ESMTP for ; Tue, 18 Feb 2020 08:27:37 +0000 (UTC) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga105.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 18 Feb 2020 00:27:37 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.70,455,1574150400"; d="scan'208";a="235466721" Received: from yhuang-dev.sh.intel.com ([10.239.159.151]) by orsmga003.jf.intel.com with ESMTP; 18 Feb 2020 00:27:35 -0800 From: "Huang, Ying" To: Peter Zijlstra , Ingo Molnar 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 , Dan Williams Subject: [RFC -V2 7/8] autonuma, memory tiering: Double hot threshold for write hint page fault Date: Tue, 18 Feb 2020 16:26:33 +0800 Message-Id: <20200218082634.1596727-8-ying.huang@intel.com> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200218082634.1596727-1-ying.huang@intel.com> References: <20200218082634.1596727-1-ying.huang@intel.com> MIME-Version: 1.0 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: From: Huang Ying The write performance of PMEM is much worse than its read performance. So even if a write-mostly pages is colder than a read-mostly pages, it is usually better to put the write-mostly pages in DRAM and read-mostly pages in PMEM. To give write-mostly pages more opportunity to be promoted to DRAM, in this patch, the hot threshold for write hint page fault is doubled (easier to be promoted). Signed-off-by: "Huang, Ying" Cc: Andrew Morton Cc: Michal Hocko Cc: Rik van Riel Cc: Mel Gorman Cc: Peter Zijlstra Cc: Ingo Molnar Cc: Dave Hansen Cc: Dan Williams Cc: linux-kernel@vger.kernel.org Cc: linux-mm@kvack.org --- include/linux/sched/numa_balancing.h | 1 + kernel/sched/fair.c | 2 ++ mm/memory.c | 3 +++ 3 files changed, 6 insertions(+) diff --git a/include/linux/sched/numa_balancing.h b/include/linux/sched/numa_balancing.h index 4899ec000245..518b3d6143ba 100644 --- a/include/linux/sched/numa_balancing.h +++ b/include/linux/sched/numa_balancing.h @@ -15,6 +15,7 @@ #define TNF_FAULT_LOCAL 0x08 #define TNF_MIGRATE_FAIL 0x10 #define TNF_YOUNG 0x20 +#define TNF_WRITE 0x40 #ifdef CONFIG_NUMA_BALANCING extern void task_numa_fault(int last_node, int node, int pages, int flags); diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index 773f3220efc4..e5f7f4139c82 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -1513,6 +1513,8 @@ bool should_numa_migrate_memory(struct task_struct *p, struct page * page, return false; th = msecs_to_jiffies(sysctl_numa_balancing_hot_threshold); + if (flags & TNF_WRITE) + th *= 2; latency = numa_hint_fault_latency(p, addr); if (latency > th) return false; diff --git a/mm/memory.c b/mm/memory.c index 207caa9e61da..595d3cd62f61 100644 --- a/mm/memory.c +++ b/mm/memory.c @@ -3829,6 +3829,9 @@ static vm_fault_t do_numa_page(struct vm_fault *vmf) if (pte_young(old_pte)) flags |= TNF_YOUNG; + if (vmf->flags & FAULT_FLAG_WRITE) + flags |= TNF_WRITE; + page = vm_normal_page(vma, vmf->address, pte); if (!page) goto unmap_out;