Received: by 2002:a25:e7d8:0:0:0:0:0 with SMTP id e207csp631554ybh; Wed, 11 Mar 2020 07:48:42 -0700 (PDT) X-Google-Smtp-Source: ADFU+vt7M7EUOMR6vefSy1x1RrV4h97KzVGQjKjaLnH0q6nXlxPOjMfAMLUnjKmroBC5G4cRieui X-Received: by 2002:aca:230f:: with SMTP id e15mr2267528oie.54.1583938122153; Wed, 11 Mar 2020 07:48:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1583938122; cv=none; d=google.com; s=arc-20160816; b=oCv5dvbrIpwf5NIfhptHX9cdqyM8HJbonzgoiK0umuaAfWjrUhqqIRpm7Y6SjIm9G4 HzYglvb3cXwGf0dTGkT7Ec9EDoJtHXgQw30EkPKyXqj/HOUioPMGJXDT3hI080s8hFxQ eux7M7JSTiCH9Hz33Yl6GS3hCnOOCGxJ+7JRYDVl9cOksnv4R1ojRS23lOMDj2HPOqPO 1woLyxcPXxhYXEWnIIUgKx+yKClfc7Jd0aVAvqDFCOmAKO085MNyNemfJJbQZd79nvih 32QeVuOwatzyUPjzg6fParMxbHOHtu1Hhkel+ixHZ5VoH1t9xJTDnqED8G1zRC+WwF4n rTcg== 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 :dkim-signature; bh=BOUrshlmd64iGTeHVHzh1lBRPXu23AyN5Nnmq3KzE6w=; b=dVMhTSYkuFGjfPlqpKjvNK3ddCCF0sYH5orGGcqY4jcDQQjtmqBnKvjDrGzVgXpWs/ n0fAPlLbNRfIHLV4SOvp7bkATOdGiFgo+d7Qe1dIwdYN4NQC0MzUAq3lyDiSsqUqnVr3 l1fC614i/0jMIH3FqWzbTLwaiRomv3sljhOEUjaH8UTtfkcUe0YqqEV2o6Ct72lxSzWh PbQIxKSjSOIcRD4L3bq5caZUnisIGZShHbkEa3skyKHM0C3OqLVfWX3n0ELXKNqTnfns 05YR/LD9PDxRymH/QncOescOK5BfZOsb42xLOFx+NNo8yvOhmhMY3NJVVQBnZ/Dyce04 uAdA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@cmpxchg-org.20150623.gappssmtp.com header.s=20150623 header.b=O7l+serY; 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=cmpxchg.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f36si1323343otf.201.2020.03.11.07.48.29; Wed, 11 Mar 2020 07:48:42 -0700 (PDT) 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; dkim=pass header.i=@cmpxchg-org.20150623.gappssmtp.com header.s=20150623 header.b=O7l+serY; 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=cmpxchg.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729810AbgCKOr4 (ORCPT + 99 others); Wed, 11 Mar 2020 10:47:56 -0400 Received: from mail-qk1-f195.google.com ([209.85.222.195]:36966 "EHLO mail-qk1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729100AbgCKOr4 (ORCPT ); Wed, 11 Mar 2020 10:47:56 -0400 Received: by mail-qk1-f195.google.com with SMTP id y126so2313982qke.4 for ; Wed, 11 Mar 2020 07:47:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cmpxchg-org.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=BOUrshlmd64iGTeHVHzh1lBRPXu23AyN5Nnmq3KzE6w=; b=O7l+serYmAbtoyZb7Way1eOmtqdMAPT5stve0l0ooG9ny3e4bGBbwKBRRjlQiar7Ti MF1wjJ/pGpKG+S9UR8lkBGo3NwP5/nHXNLvpcxBTdfgF2lmEXmga82VupDDZK8SEtX/r ya+qAc23/J8Mvuyql73riRdxu6jfNAlePON7q39W08x1mLYU7xnfp/ABPUS2HByFgY1j 0tKl6PULXkoWbg1cfHNar1khYiaCuSaPR/CmTMhHadMU8oSTHIXkGZA1bEfJhuKqaGz+ sVU8rFAk5A7xA+/IQCWn5T2MeQI71fw7wFLDHIU8vhi21pKlQL6pNbv8Juj12Dig4/op DNXw== 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=BOUrshlmd64iGTeHVHzh1lBRPXu23AyN5Nnmq3KzE6w=; b=iyJuQGnyIKsTNX2uB/ZhCxDtTOdwtt+qFLXsVKx5XHuCNyu4T+UJTEWnMoTy+1aQ35 K42yu0Ooodwp/BhmPUuxnXPNM1VX0TYrRRyc3jQLKG6f6kIeiBkjyQVPFm01cYHH62eH SBPFciUSvjCH3ZMvYC8x5a1mA2Kz2p0n2vsHGbNFDhDGegEYqbHVU2HYzW5U93OKxndm tbYvTGoZVscTJ3GccW2KRV7OKBb1DBy94nSy0jI3/2nYelik8ygx/DuftuLvOcAbMK6W Xx2s06lFeRL2zPrCQ5mgjPyDhI09Uz6lzIOd0VlyaS1mhzIMwD26DoqIBz4f6R8GCeCG AtiA== X-Gm-Message-State: ANhLgQ0C1z8Jd8DlQjjo2AJywq8ngvieNouM4+CQIeG1IN5OLCMA5eJU 5UQQtA1mCBKWW/k987pSil69nA== X-Received: by 2002:a37:4b4c:: with SMTP id y73mr3022722qka.467.1583938073760; Wed, 11 Mar 2020 07:47:53 -0700 (PDT) Received: from localhost ([2620:10d:c091:480::d51c]) by smtp.gmail.com with ESMTPSA id l2sm2141844qtq.69.2020.03.11.07.47.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Mar 2020 07:47:53 -0700 (PDT) Date: Wed, 11 Mar 2020 10:47:51 -0400 From: Johannes Weiner To: "Huang, Ying" Cc: David Rientjes , Andrew Morton , linux-mm@kvack.org, linux-kernel@vger.kernel.org, David Hildenbrand , Michal Hocko , Dave Hansen , Mel Gorman , Vlastimil Babka , Minchan Kim , Hugh Dickins , Rik van Riel , Matthew Wilcox Subject: Re: [PATCH] mm: Add more comments for MADV_FREE Message-ID: <20200311144751.GA29835@cmpxchg.org> References: <20200311011117.1656744-1-ying.huang@intel.com> <87imjbv51t.fsf@yhuang-dev.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87imjbv51t.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, Mar 11, 2020 at 01:22:54PM +0800, Huang, Ying wrote: > David Rientjes writes: > > > On Wed, 11 Mar 2020, Huang, Ying wrote: > > > >> diff --git a/include/linux/mm_inline.h b/include/linux/mm_inline.h > >> index 6f2fef7b0784..01144dd02a5f 100644 > >> --- a/include/linux/mm_inline.h > >> +++ b/include/linux/mm_inline.h > >> @@ -9,10 +9,11 @@ > >> * page_is_file_cache - should the page be on a file LRU or anon LRU? > >> * @page: the page to test > >> * > >> - * Returns 1 if @page is page cache page backed by a regular filesystem, > >> - * or 0 if @page is anonymous, tmpfs or otherwise ram or swap backed. > >> - * Used by functions that manipulate the LRU lists, to sort a page > >> - * onto the right LRU list. > >> + * Returns 1 if @page is page cache page backed by a regular filesystem or > >> + * anonymous page lazily freed (e.g. via MADV_FREE). Returns 0 if @page is > >> + * normal anonymous page, tmpfs or otherwise ram or swap backed. Used by > >> + * functions that manipulate the LRU lists, to sort a page onto the right LRU > >> + * list. > > > > The function name is misleading: anonymous pages that can be lazily freed > > are not file cache. This returns 1 because of the question it is asking: > > anonymous lazily freeable pages should be on the file lru, not the anon > > lru. So before adjusting the comment I'd suggest renaming the function to > > something like page_is_file_lru(). > > Yes. I think page_is_file_lru() is a better name too. And whether > tmpfs pages are file cache pages is confusing too. But I think we can > do that after this patch if others think this is a good idea too. I also think the rename is a great idea. Personally, I'd prefer it in the same patch. Right now the name and the documentation are out of date, but at least they're consistent in their view of the world. Fixing this interface - name and documentation - to reflect the existence of MADV_FREE anon pages is one logical change, not two.