Received: by 2002:a25:c205:0:0:0:0:0 with SMTP id s5csp4412073ybf; Wed, 4 Mar 2020 03:28:07 -0800 (PST) X-Google-Smtp-Source: ADFU+vs9C8HJH9EssLFsvSEkpvTqdEzYq9homC4qDLWYTwSlzteP6NMCmjXTSsYdigxbZXLQjccU X-Received: by 2002:a9d:76d6:: with SMTP id p22mr1998897otl.37.1583321287053; Wed, 04 Mar 2020 03:28:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1583321287; cv=none; d=google.com; s=arc-20160816; b=j4xH/qk5jjkM1KU2g4ZzwODH9EiZD+5ybND6UNXdvvYxcoLeEhjgSTbfAh2YeAG46F CHLKtaEoGU6OyRObFtD7riZlLX4VTbM/kc5SmQfrjzrjxvXeef+Ho0z2+s1xP1AJAVE8 067vjd0TUahVIgPI2dffvhY/mSLiO9FTugunubAgpuYmxVkiJsSSq1dQrQL7ICdxn2sr TESm+nY7sNpc2XBLhst/HJM4f12ZahiGeSimAl4p/Dq+aUXGEg/vyzKyKGXwO9AljZpb aqvO0xrQTCAeV7GhO9FARPt1kRrEOfElzlTAOKcU6i//e3YPcJzIKgBaqI0CBkWM32LD rTXg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=bH3fISo8TLwz0Zch/JAF6ezBy0LKas5gSdqAMX74AuQ=; b=E6iNM06jpMzl7ppl50g5uLlVGSmlugIWDn0Q+nEdY7CC/g80BbSiNm+gQLanmbj6we axSFzJwzP/Y3OfIKz+V4AjFaAyOw3Pd1+UtkN+8v2t9oFyUD2YIaIX03jxs+PeXyRMnd KmZXOPewnKZbV/7FU7gZ6Y7A5cizW+s+AOsLgxZqoV+pyzQuaqA5LWaRfmd6apsZqtnW RfM8NiT5vj956ddt/yHYoQ7OMFMocycdd9uh7GSmLvaxJIyhZbTCokkFUfv4H+uYTIwS 3cYwq00iO6rb3t1n6fkOErasxenwfjb+9p/maZvWuw3d3E50BUU4464ocP7gElYkkqWs gTmg== 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=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p12si1004114otk.173.2020.03.04.03.27.54; Wed, 04 Mar 2020 03:28:07 -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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729256AbgCDL04 (ORCPT + 99 others); Wed, 4 Mar 2020 06:26:56 -0500 Received: from mail-wr1-f51.google.com ([209.85.221.51]:41187 "EHLO mail-wr1-f51.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728953AbgCDL04 (ORCPT ); Wed, 4 Mar 2020 06:26:56 -0500 Received: by mail-wr1-f51.google.com with SMTP id v4so1926883wrs.8 for ; Wed, 04 Mar 2020 03:26:55 -0800 (PST) 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=bH3fISo8TLwz0Zch/JAF6ezBy0LKas5gSdqAMX74AuQ=; b=G/b/+R4wHEdOVX5WgbULi2JZJjbHCFFvveJgmWUGvgKzePUuaC/OD/aNxQfxRMiGjv VVky5HkRCwVv/YB5VGXoegLhp4y5bn4mnwDSlzEzRQXcvHLqwPx5BD+/Q9mf+xnweE3q yNVmDeJyJrbUmeYAqyp574JchxLyhE8WseyNbf84io9uQVv/i1mM8qrGS9TzpZHRlZ9U osm4BoRxq7fICqrlowXGzPOgNAsirDoM9v/kaZdcfYSX0z9nCg2DVws14NCZpyUhGEar hH/flawuKremyg4CJw3qX/4836OQ/GTKlDP6bIQRjbYRV24LgAqkQm0fyAWFtdcDwRgn CvCQ== X-Gm-Message-State: ANhLgQ0+johhGNKSENLkYL+0tqsVNMNfSbZPUgCQ9jpvHc2p+Rjsx/+R Gxudb2i7ZH/iqotNGDA4kjk= X-Received: by 2002:adf:e98f:: with SMTP id h15mr3788899wrm.263.1583321214487; Wed, 04 Mar 2020 03:26:54 -0800 (PST) Received: from localhost (prg-ext-pat.suse.com. [213.151.95.130]) by smtp.gmail.com with ESMTPSA id i1sm17963622wrs.18.2020.03.04.03.26.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Mar 2020 03:26:53 -0800 (PST) Date: Wed, 4 Mar 2020 12:26:53 +0100 From: Michal Hocko To: "Huang, Ying" Cc: Mel Gorman , David Hildenbrand , Johannes Weiner , Matthew Wilcox , Andrew Morton , linux-mm@kvack.org, linux-kernel@vger.kernel.org, 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 Message-ID: <20200304112653.GH16139@dhcp22.suse.cz> References: <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> <87blpc2wxj.fsf@yhuang-dev.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87blpc2wxj.fsf@yhuang-dev.intel.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed 04-03-20 19:15:20, Huang, Ying wrote: > Michal Hocko writes: > > > On Tue 03-03-20 19:49:53, Huang, Ying wrote: [...] > >> 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. > > In which situation the cost to reconstruct MADV_FREE pages can be higher > than the cost to allocate file cache page and read from disk? Heavy > contention on mmap_sem? Allocating a page might be really costly but even without that. Reconstructnig the content of the page can be really high and actually much larger than an IO to get a page from the storage. Consider decompression or some other transformations to get the content. Userspace has means to detect that the content is still up-to-date as already has been mentioned so all those steps can be avoided. -- Michal Hocko SUSE Labs