Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp258647pxf; Wed, 24 Mar 2021 04:36:33 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx70B+sWf/uwRQU/4bHzRcJgV4px9kYRkE5KM4UVFdPH2spI2wFOuUT8sKpu/lSD511wsQk X-Received: by 2002:a17:907:2112:: with SMTP id qn18mr3093811ejb.220.1616585793711; Wed, 24 Mar 2021 04:36:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1616585793; cv=none; d=google.com; s=arc-20160816; b=zygAr8NbbfI6lHemgyvxI2WzldsNxS12L+v8UykxYUoBwpksfzBLuUddq7CY3u9Bn7 j5yGSSD276k0zueXZm4Lx5C55FMxNM91N8yhEtsrSrwsW/IcqOsjbXQgAb2bEBj+nsBT AGftDTADpQjUNFmx41Elf0NgKPEc+gPol/PqVHyDx/rq3gJskNqI4fmcFguQPvmweGph CEj/jrtLyOf9LVd/lCH4MUR0xKeN82G0nKI0mygh4IiwioIrq7VSHe9F7sOVplurhldQ QB8EjoR4cuvj4WYRy+cy5/TF9L3/wkXFsWyZIDrKhLCKA+F3nSDTLwpC9hlNw3Yhn+6u XY5A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=wZnylD5tM433zbWgIi+MFmJNGyb3spaxKPSRW5ynSxQ=; b=hBLj23VJlti2x93Oi0TaVDANgqb494zRggcqrPP7l0l45hcFo98rQK5386b+4owpJG T+oNTNHPe9+RWiBFn7Vk+mpp4yFRjRaS362bYuIuGMc48hVT7JNcS77Pf2nI0kT76gBd UGZU7orBm9mDLNy0Ktkqwefda1pQQWDxiwJZJ9A3HzGUUN/BmNKwtg0Z4mkAS+MsboAg DHM8xKXkTeHovpj+jjTXmuBBi89V24DewRUAK4E8r2I/2O7T97f1ECOoSgW4NTjc4/DR +fO2/QwpBEflNVFQvkzZIPF1UoZ4pw9VZXpi6XKfnYsjlv/TTdLhxFdludpLT4e4remf P/Xw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id hr30si1444704ejc.545.2021.03.24.04.35.52; Wed, 24 Mar 2021 04:36:33 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233311AbhCXKbc (ORCPT + 99 others); Wed, 24 Mar 2021 06:31:32 -0400 Received: from mx2.suse.de ([195.135.220.15]:50008 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230436AbhCXKbL (ORCPT ); Wed, 24 Mar 2021 06:31:11 -0400 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) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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