Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp4043486pxf; Tue, 16 Mar 2021 04:30:22 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwyY/obduKN4rjvOV3Zc9lldDNr45KQ59R2qRKyZ3PktBuc7kOydnn27DOtb1rLVxKvL8sv X-Received: by 2002:a17:906:8043:: with SMTP id x3mr28532310ejw.149.1615894221783; Tue, 16 Mar 2021 04:30:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1615894221; cv=none; d=google.com; s=arc-20160816; b=kNDbgBMbPsGX/6IlUHsQnLdojG+etGMGe4APxL1tIi2cL5gMlk7f3vfFeHaMByR6Ay soKNmBntAu4xU7yfH/dJ5FOehzCtKvtjbkVSvfyPa5T/pcrMc4IYnAjSrc505jdzzhkF zpwpdmBecRf5dMJVduvNCGQcD+xMhFuEIwb/P2frP+T0N1sP4JQA3+fGNOCZhUO6YMyB 35RFf420jzWRM451TL+T5Tz4SJF/XNSzgANL2P7aVnIm6EQrA3LH2MTuPRUiDHLq6aLB w+jYuBkW30UvDv3CdrRY4zPkUdQWRYYYQa8IWE85TNdCt1kfRKKmSxSDOyjaQDRVaW6r TbFA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=qa8CZwJOeZFJUfkuJ5OjeuaRp9kzYHq6lZBFu2jA+Gw=; b=WFB8JngrRsjKOgqdv3NV+u4YZYyW8D4SkP1b6tH5Q9OCs+S/TQDb0ZF9rTFIh6uSGW rYmUp9n034qviPRyjuqQsfXkHcyqkoEgBct3wVt9AHJ4JTFEanQchcv3k/sQjTMu8fHT isuNnkRevBkwGt/cPnBA5KmtW+WhirX7S/QbQAUreXWgEeS9caPfIT2W7NHscEDnGipC dkuaCkRQvgGjo0GxRVdSa/WIWhxXGWs/4hOafqg87Xmb97zs/DloxfwROKFvuNU7MB3T vAxeveej13SRI34C5/IwSAvh+IWmYOylmihSYnNc+Ub8uHLgGBzMhoIRDzx7GUtmQbav rOuA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b="K6nq/jUY"; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id s18si13609623edr.249.2021.03.16.04.29.57; Tue, 16 Mar 2021 04:30:21 -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; dkim=pass header.i=@google.com header.s=20161025 header.b="K6nq/jUY"; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231340AbhCPD5U (ORCPT + 99 others); Mon, 15 Mar 2021 23:57:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56322 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233328AbhCPD5H (ORCPT ); Mon, 15 Mar 2021 23:57:07 -0400 Received: from mail-io1-xd33.google.com (mail-io1-xd33.google.com [IPv6:2607:f8b0:4864:20::d33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DB89EC06174A for ; Mon, 15 Mar 2021 20:57:06 -0700 (PDT) Received: by mail-io1-xd33.google.com with SMTP id w11so9973320iol.13 for ; Mon, 15 Mar 2021 20:57:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=qa8CZwJOeZFJUfkuJ5OjeuaRp9kzYHq6lZBFu2jA+Gw=; b=K6nq/jUY0UMPI4TsIymeF0yspJqJuN1e2Z/ELnVv5em0SXtGDAABy7ex9PGaTNWwSl N1Fq6HTh6rmKDN3STw8c2mhsUy7YH6cKAPaIiEOI9GVz0Lh+liGEC7CSGEnnSG6YIEat JCmYLtK7lOXFqGwBjPrEKy4YWNkKIwX/H+BY9U/nrbu1dIbmOQI49D77iPSweFNlLspI YWzk8P7mgvaos+kVOn3k1gezit5F1w6aSLY0QPGjjqAMCBilHvtlNvjK6pCPt1ufWI3s 0LegBteUZudjGDyj7eQ/2NqYTKnqdQBmHtYLD9yFbEUP3fFmrlJIrh4norJ0TtqqwnSL 641g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=qa8CZwJOeZFJUfkuJ5OjeuaRp9kzYHq6lZBFu2jA+Gw=; b=cLgH4Mha5AnoqWZonlKnqyjvv5BxPVPPJr+XaWSYueD009Z/qnkYq0RNprkfcuZmnk HVtLD4HdhPJo7Ox9ocE2SQTvtuWQ5PyYU6H/xreRwc3JyqsflTkOIS8xJCsCsiWmfzzV XXvF2jH0znfbwqFPIrPgslLKUcs7qp0lh6ICIsMsf5/zMLJiCl55JKRDZ3WJqRcVpLlr HYtK7bqVNHvZy6JeWmBanSzLeBcFS1lDd6qG2rIgaCZEQHHoO7hqNBwF2WVIQq+UrnJk lDFS3NFBPLfXanlIvK2dKeZquKy4+i3r9RIj7fa9FzS1bSepXJlqTn7bMcmhwjbmlHMB 4czQ== X-Gm-Message-State: AOAM5304+7Mite0wXgndhylSz3Z+2ahreyaKoOxsXDTbVN0ESft+P7aw AfZxsxaK7HorBxZNI8c5PlOfbg== X-Received: by 2002:a5d:9f4a:: with SMTP id u10mr1932727iot.186.1615867026137; Mon, 15 Mar 2021 20:57:06 -0700 (PDT) Received: from google.com ([2620:15c:183:200:d825:37a2:4b55:995f]) by smtp.gmail.com with ESMTPSA id y13sm6447282ioc.36.2021.03.15.20.57.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 Mar 2021 20:57:05 -0700 (PDT) Date: Mon, 15 Mar 2021 21:57:00 -0600 From: Yu Zhao To: "Huang, Ying" Cc: Rik van Riel , linux-mm@kvack.org, Alex Shi , Andrew Morton , Dave Hansen , Hillf Danton , Johannes Weiner , Joonsoo Kim , Matthew Wilcox , Mel Gorman , Michal Hocko , Roman Gushchin , Vlastimil Babka , Wei Yang , Yang Shi , linux-kernel@vger.kernel.org, page-reclaim@google.com Subject: Re: [PATCH v1 09/14] mm: multigenerational lru: mm_struct list Message-ID: References: <20210313075747.3781593-1-yuzhao@google.com> <20210313075747.3781593-10-yuzhao@google.com> <048e5e1e977e720c3f9fc536ac54beebcc8319f5.camel@surriel.com> <87pmzzsvfb.fsf@yhuang6-desk1.ccr.corp.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87pmzzsvfb.fsf@yhuang6-desk1.ccr.corp.intel.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Mar 16, 2021 at 10:07:36AM +0800, Huang, Ying wrote: > Rik van Riel writes: > > > On Sat, 2021-03-13 at 00:57 -0700, Yu Zhao wrote: > > > >> +/* > >> + * After pages are faulted in, they become the youngest generation. > >> They must > >> + * go through aging process twice before they can be evicted. After > >> first scan, > >> + * their accessed bit set during initial faults are cleared and they > >> become the > >> + * second youngest generation. And second scan makes sure they > >> haven't been used > >> + * since the first. > >> + */ > > > > I have to wonder if the reductions in OOM kills and > > low-memory tab discards is due to this aging policy > > change, rather than from the switch to virtual scanning. There are no policy changes per se. The current page reclaim also scans a faulted-in page at least twice before it can reclaim it. That said, the new aging yields a better overall result because it discovers every page that has been referenced since the last scan, in addition to what Ying has mentioned. The current page scan stops stops once it finds enough candidates, which may seem more efficiently, but actually pays the price for not finding the best. > If my understanding were correct, the temperature of the processes is > considered in addition to that of the individual pages. That is, the > pages of the processes that haven't been scheduled after the previous > scanning will not be scanned. I guess that this helps OOM kills? Yes, that's correct. > If so, how about just take advantage of that information for OOM killing > and page reclaiming? For example, if a process hasn't been scheduled > for long time, just reclaim its private pages. This is how it works. Pages that haven't been scanned grow older automatically because those that have been scanned will be tagged with younger generation numbers. Eviction does bucket sort based on generation numbers and attacks the oldest.