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=-5.3 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_SANE_1 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 DDE1BC433DB for ; Wed, 24 Mar 2021 10:31:13 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 276A8619E4 for ; Wed, 24 Mar 2021 10:31:13 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 276A8619E4 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=suse.de Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 90A146B02B8; Wed, 24 Mar 2021 06:31:12 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 8A8906B02B9; Wed, 24 Mar 2021 06:31:12 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 724FF6B02BA; Wed, 24 Mar 2021 06:31:12 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0174.hostedemail.com [216.40.44.174]) by kanga.kvack.org (Postfix) with ESMTP id 52E6E6B02B8 for ; Wed, 24 Mar 2021 06:31:12 -0400 (EDT) Received: from smtpin20.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 0C392181AEF3E for ; Wed, 24 Mar 2021 10:31:12 +0000 (UTC) X-FDA: 77954400384.20.AA15EB7 Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by imf18.hostedemail.com (Postfix) with ESMTP id 18AF12000248 for ; Wed, 24 Mar 2021 10:31:10 +0000 (UTC) X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 3241AACBF; Wed, 24 Mar 2021 10:31:10 +0000 (UTC) Date: Wed, 24 Mar 2021 10:31:04 +0000 From: Mel Gorman To: Huang Ying Cc: linux-mm@kvack.org, Andrew Morton , linux-kernel@vger.kernel.org, Yu Zhao , Hillf Danton , Johannes Weiner , Joonsoo Kim , Matthew Wilcox , Michal Hocko , Roman Gushchin , Vlastimil Babka , Wei Yang , Yang Shi Subject: Re: [RFC] mm: activate access-more-than-once page via NUMA balancing Message-ID: <20210324103104.GN15768@suse.de> References: <20210324083209.527427-1-ying.huang@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-15 Content-Disposition: inline In-Reply-To: <20210324083209.527427-1-ying.huang@intel.com> User-Agent: Mutt/1.10.1 (2018-07-13) X-Stat-Signature: 5gtd8oz6bfh3m7184rbdb1ptxnaq54uz X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: 18AF12000248 Received-SPF: none (suse.de>: No applicable sender policy available) receiver=imf18; identity=mailfrom; envelope-from=""; helo=mx2.suse.de; client-ip=195.135.220.15 X-HE-DKIM-Result: none/none X-HE-Tag: 1616581870-728426 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, Mar 24, 2021 at 04:32:09PM +0800, Huang Ying wrote: > One idea behind the LRU page reclaiming algorithm is to put the > access-once pages in the inactive list and access-more-than-once pages > in the active list. This is true for the file pages that are accessed > via syscall (read()/write(), etc.), but not for the pages accessed via > the page tables. We can only activate them via page reclaim scanning > now. This may cause some problems. For example, even if there are > only hot file pages accessed via the page tables in the inactive list, > we will enable the cache trim mode incorrectly to scan only the hot > file pages instead of cold anon pages. > I caution against this patch. It's non-deterministic for a number of reasons. As it requires NUMA balancing to be enabled, the pageout behaviour of a system changes when NUMA balancing is active. If this led to pages being artificially and inappropriately preserved, NUMA balancing could be disabled for the wrong reasons. It only applies to pages that have no target node so memory policies affect which pages are activated differently. Similarly, NUMA balancing does not scan all VMAs and some pages may never trap a NUMA fault as a result. The timing of when an address space gets scanned is driven by the locality of pages and so the timing of page activation potentially becomes linked to whether pages are local or need to migrate (although not right now for this patch as it only affects pages with a target nid of NUMA_NO_NODE). In other words, changes in NUMA balancing that affect migration potentially affect the aging rate. Similarly, the activate rate of a process with a single thread and multiple threads potentially have different activation rates. Finally, the NUMA balancing scan algorithm is sub-optimal. It potentially scans the entire address space even though only a small number of pages are scanned. This is particularly problematic when a process has a lot of threads because threads are redundantly scanning the same regions. If NUMA balancing ever introduced range tracking of faulted pages to limit how much scanning it has to do, it would inadvertently cause a change in page activation rate. NUMA balancing is about page locality, it should not get conflated with page aging. -- Mel Gorman SUSE Labs