Received: by 2002:a25:c205:0:0:0:0:0 with SMTP id s5csp5118734ybf; Wed, 4 Mar 2020 17:43:33 -0800 (PST) X-Google-Smtp-Source: ADFU+vuM5urzrOiZlSchYQ9TC/bBajQ9fv6hGQC8aC3XUA4Od9zZu8CD0iJ6m5PC3PPxKBWcKKu0 X-Received: by 2002:aca:d694:: with SMTP id n142mr3764904oig.73.1583372613224; Wed, 04 Mar 2020 17:43:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1583372613; cv=none; d=google.com; s=arc-20160816; b=bkSKiUr563THVLrTox4JaS+Js2FvZthZu8BmeKhVBiW0ADbohEVB3G6ApsnXyGARgF c5UQl7onkqK72zq434sEzlNCZ3K+jKT86EIFgNQSQIXcXKzsCqwE+eWFaNki9U1mYwKB CJZ5ig3xoJSz+5AkuDeWXPkvK+YayhdFBbqxie8k3wOsRfPj/CXUFwyl+hCXAgbP2SKh FQyom1zm1equ6GZtqNX71Pku1mXHBHB2YVNF9GCfBFtNUvfQmh4JXuDAdLhzbWT5SK/Y ljukyuzbJZAzcgyco1unnC2JcyG8Z+8C/0j5qXznUDzdfR3AOmcKmFb3hibPnfUz1An6 utIQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:message-id :in-reply-to:date:references:subject:cc:to:from; bh=+Glw8YTXUUUI7Yzay/UoZoCIR5pYMBylN+XwrVtJU3s=; b=fpqEk6qRh+7EKqkx/VKm7kfzP8xKcEb4ECos+QnxVFZlYqcfjhG6uXB6mCRuJ3VShN od3KAClXSj0nIDjU8VHFmbP+Ic7sEnVr9LXxTiE4jhxWM40nZm07wWzYrR4hhDHlAPUR 1zTiI0wfyGEYn39zB30r10hjZexf5KbdITFLO7KuDdnZy3eMaPlfBvHOuDZObylaLU/m bFTLtOlC9JEkSqM9P3qteW8Su2VHFb5xjRDC5qRlLZUjIoMex2VcXRsbQe6aYn4oOgB+ ZaR4uu9+P6D3pBQiJKdpnHs+p2YZh2EnJ/Q/He8UObTBZ0mR3KfYvWT5ZgMZZKEF3B45 Uzlg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v6si2329440oia.200.2020.03.04.17.43.19; Wed, 04 Mar 2020 17:43:33 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725838AbgCEBm5 (ORCPT + 99 others); Wed, 4 Mar 2020 20:42:57 -0500 Received: from mga09.intel.com ([134.134.136.24]:1074 "EHLO mga09.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725810AbgCEBm5 (ORCPT ); Wed, 4 Mar 2020 20:42:57 -0500 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 04 Mar 2020 17:42:56 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.70,516,1574150400"; d="scan'208";a="287527628" Received: from yhuang-dev.sh.intel.com (HELO yhuang-dev) ([10.239.159.23]) by FMSMGA003.fm.intel.com with ESMTP; 04 Mar 2020 17:42:52 -0800 From: "Huang\, Ying" To: Mel Gorman Cc: Michal Hocko , David Hildenbrand , Johannes Weiner , Matthew Wilcox , Andrew Morton , , , Vlastimil Babka , Zi Yan , Peter Zijlstra , Dave Hansen , "Minchan Kim" , Hugh Dickins , Alexander Duyck Subject: Re: [RFC 0/3] mm: Discard lazily freed pages when migrating References: <871rqf850z.fsf@yhuang-dev.intel.com> <20200228094954.GB3772@suse.de> <87h7z76lwf.fsf@yhuang-dev.intel.com> <20200302151607.GC3772@suse.de> <87zhcy5hoj.fsf@yhuang-dev.intel.com> <20200303080945.GX4380@dhcp22.suse.cz> <87o8td4yf9.fsf@yhuang-dev.intel.com> <20200303085805.GB4380@dhcp22.suse.cz> <87ftep4pzy.fsf@yhuang-dev.intel.com> <20200304095802.GE16139@dhcp22.suse.cz> <20200304105607.GF3772@suse.de> Date: Thu, 05 Mar 2020 09:42:52 +0800 In-Reply-To: <20200304105607.GF3772@suse.de> (Mel Gorman's message of "Wed, 4 Mar 2020 10:56:07 +0000") Message-ID: <877dzz37c3.fsf@yhuang-dev.intel.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=ascii Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Mel Gorman writes: > On Wed, Mar 04, 2020 at 10:58:02AM +0100, Michal Hocko wrote: >> > >> If my understanding were correct, the newly migrated clean MADV_FREE >> > >> pages will be put at the head of inactive file LRU list instead of the >> > >> tail. So it's possible that some useful file cache pages will be >> > >> reclaimed. >> > > >> > > This is the case also when you migrate other pages, right? We simply >> > > cannot preserve the aging. >> > >> > So you consider the priority of the clean MADV_FREE pages is same as >> > that of page cache pages? >> >> This is how MADV_FREE has been implemented, yes. See f7ad2a6cb9f7 ("mm: >> move MADV_FREE pages into LRU_INACTIVE_FILE list") for the >> justification. >> >> > Because the penalty difference is so large, I >> > think it may be a good idea to always put clean MADV_FREE pages at the >> > tail of the inactive file LRU list? >> >> You are again making assumptions without giving any actual real >> examples. Reconstructing MADV_FREE pages cost can differ a lot. This >> really depends on the specific usecase. Moving pages to the tail of LRU >> would make them the primary candidate for the reclaim with a strange >> LIFO semantic. Adding them to the head might be not the universal win >> but it will at least provide a reasonable FIFO semantic. I also find >> it much more easier to reason about MADV_FREE as an inactive cache. > > I tend to agree, that would make MADV_FREE behave more like a > PageReclaim page that gets tagged for immediate reclaim when writeback > completes. Immediate reclaim is in response to heavy memory pressure where > there is trouble finding clean file pages to reclaim and dirty/writeback > pages are getting artifically preserved over hot-but-clean file > pages. That is a clear inversion of the order pages should be reclaimed > and is justified. While there *might* be a basis for reclaiming MADV_FREE > sooner rather than later, there would have to be some evidence of a Page > inversion problem where a known hot page was getting reclaimed before > MADV_FREE pages. For example, it could easily be considered a bug to free > MADV_FREE pages over a page that was last touched at boot time. Yes. This sounds reasonable. Although the current solution isn't perfect, it can avoid the really bad situation as above. Best Regards, Huang, Ying