From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.8 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A3252C10F27 for ; Wed, 11 Mar 2020 14:47:56 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 12EA5206B1 for ; Wed, 11 Mar 2020 14:47:54 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=cmpxchg-org.20150623.gappssmtp.com header.i=@cmpxchg-org.20150623.gappssmtp.com header.b="O7l+serY" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 12EA5206B1 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=cmpxchg.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id E006E6B0008; Wed, 11 Mar 2020 10:47:55 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id DB1C66B000C; Wed, 11 Mar 2020 10:47:55 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id CA04D6B000D; Wed, 11 Mar 2020 10:47:55 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id B322B6B0008 for ; Wed, 11 Mar 2020 10:47:55 -0400 (EDT) Received: from smtpin30.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id A5264824556B for ; Wed, 11 Mar 2020 14:47:55 +0000 (UTC) X-FDA: 76583360910.30.dad55_aea057ad2263 X-HE-Tag: dad55_aea057ad2263 X-Filterd-Recvd-Size: 5426 Received: from mail-qk1-f195.google.com (mail-qk1-f195.google.com [209.85.222.195]) by imf22.hostedemail.com (Postfix) with ESMTP for ; Wed, 11 Mar 2020 14:47:54 +0000 (UTC) Received: by mail-qk1-f195.google.com with SMTP id c145so2268832qke.12 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=G1b6/y0voX0SZAoRbOXi2i72/mTLScstmqdKF9W/wj4Mjr1RrYoI4nCGxVtdA5VHoE MpJpRsfH8DJ5V9ixCG9CpapeRkhBruDLUog9G4wjM+8hxViRgRm/vv7XYn+WvdUTB6zi crxXy06BrcKkZz7aCYgcbQv5RsyJsZ0OhBsmDBmxrw5XyHuxPJ6OyvmfjQDC3mAgYPcW s0OKoTq3kint+OEj9n1JnpwRLiVVd8PzKZG8/bkLFzItk1+X3vVwp70OvQVK/14J+GzE 9GQKR7rpGBfQuhoDrpsgVTKXtjQjKG5/eykYUgsQhvF16Omcfok/L+CrnKH5NxNIoPTZ 0iWw== X-Gm-Message-State: ANhLgQ050fpbdMmkw1UA6mzhMK6MD5dJwBX59cokudeUvW8dgDvo/oES zMFTBXZpTCtQezUJA4NT7PzV3A== X-Google-Smtp-Source: ADFU+vvQXun96za+DjYFW6UuPN81X4lp0zCuOkb0lhVTCjaqQyj+2+822GXzi2x0Y47GY1gpLd+CNA== 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> X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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.