Received: by 2002:a25:c205:0:0:0:0:0 with SMTP id s5csp6402816ybf; Thu, 5 Mar 2020 20:06:15 -0800 (PST) X-Google-Smtp-Source: ADFU+vswvfVkQJf9PwcRYtkHJ7V5M7rNH5Wi501pAxZHgKZUsg4NVNrkBE3T5WZSRXZLFnYVAEa7 X-Received: by 2002:aca:3f54:: with SMTP id m81mr1277819oia.167.1583467575470; Thu, 05 Mar 2020 20:06:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1583467575; cv=none; d=google.com; s=arc-20160816; b=aCL+UjXQEytDqXHteU5dIvXI/wI3ohy5tJ2dymufe5Zbv78sLOiL2Ck3MmAopA2tX+ QSm0lIKUP67UKYl92/WURqSqh5EPS/4ZVcbWMpq3A3goaJaB4Gssr5WVia/Nkxorkg9I ZXW6RgX83QwUQNy0A2PK2f0+aCaBDrKd+PlU+XV+QuMBnClDAwZKSWB2PanyRVHT8pBR StUdHjGCy/R0I5OH4tEQY519nIuIdwNh8YG+W6eMQ8KhfblkWoYHPy1iekkHvZEQMUwH icJSPN3KxCqSUy/fOukVL1tUvNroNcPjCOZGlnOxK0MBa8YAMC0Y7ofHtA7OAVD0o5v3 niHQ== 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=pubwccD4zva/Arqm24TRTyqFIAw0SzviS9g9J1fds3c=; b=coDnpRz0TeQGNtJ7g5MltEIC+7S9n+yM20zyqj0yi4tsjBHuRtNukflpHJgDM3HqUA 9GJgh5kiDipm4pu8Fw44mIGDot0YdPU06H+dT29HPKdLYZCe7tJm/VwkEIEkV3KArbLO EVW/BEI4IxMKdI4YFpsooxQfVJEFIaDJydLL3J8GEQzclpGkpJ4cnzwkPeRAfY4ejWTD YqK97ObhJAFA0kSsH+ovaphVC9XmTw7CSoPWBzXUL/9UurOFigwRi90UzG//TbKkOcli 3S7YTmG/iLTbmjm5k+tLTHdrQA3vG3AG07ig+qwHEJ1fJnLjKplAC5MbtJRV2Ri8zdWP 8wmQ== 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 z14si623315oih.89.2020.03.05.20.06.03; Thu, 05 Mar 2020 20:06:15 -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 S1726563AbgCFEFk (ORCPT + 99 others); Thu, 5 Mar 2020 23:05:40 -0500 Received: from mga14.intel.com ([192.55.52.115]:4332 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726378AbgCFEFk (ORCPT ); Thu, 5 Mar 2020 23:05:40 -0500 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 05 Mar 2020 20:05:39 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.70,520,1574150400"; d="scan'208";a="229935328" Received: from yhuang-dev.sh.intel.com (HELO yhuang-dev) ([10.239.159.23]) by orsmga007.jf.intel.com with ESMTP; 05 Mar 2020 20:05:35 -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: <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> <20200305104859.GG3772@suse.de> Date: Fri, 06 Mar 2020 12:05:35 +0800 In-Reply-To: <20200305104859.GG3772@suse.de> (Mel Gorman's message of "Thu, 5 Mar 2020 10:48:59 +0000") Message-ID: <87r1y6yvow.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 07:15:20PM +0800, Huang, Ying wrote: >> 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? >> > > MADV_FREE should be anonymous only > > if (behavior == MADV_FREE) > return madvise_free_single_vma(vma, start, end); > > ..... > > static int madvise_free_single_vma(struct vm_area_struct *vma, > unsigned long start_addr, unsigned long end_addr) > { > struct mm_struct *mm = vma->vm_mm; > struct mmu_notifier_range range; > struct mmu_gather tlb; > > /* MADV_FREE works for only anon vma at the moment */ > if (!vma_is_anonymous(vma)) > return -EINVAL > > So the question is not applicable. For anonymous memory, the cost of > updating a PTE is lower than allocating a page, zeroing it and updating > the PTE. Sorry for confusing. The original question is NOT about comparing the reconstruction cost between MADV_FREE anon pages and MADV_FREE file pages, BUT about comparing the reconstruction cost between MADV_FREE anon pages and ordinary clean file cache pages. You can find more details in conversation between Michal and me. > It has been repeatedly stated now for almost a week that a semantic > change to MADV_FREE should be based on a problem encountered by a real > application that can benefit from the new semantics. I think the only > concrete outcome has been that userspace potentially benefits if the total > number of MADV_FREE pages is reported globally. Even that is marginal as > smaps has the information to tell the difference between high RSS due to > a memory leak and high RSS usage due to MADV_FREE. The /proc/vmstats for > MADV_FREE are of marginal benefit given that they do not tell us much > about the current number of MADV_FREE pages in the system. Got it! Thanks a lot for your patience and sharing. That's very helpful. Best Regards, Huang, Ying