Received: by 2002:a25:e7d8:0:0:0:0:0 with SMTP id e207csp3535634ybh; Tue, 17 Mar 2020 01:51:50 -0700 (PDT) X-Google-Smtp-Source: ADFU+vtagGyAIndXOiQRNixcbI6lFr6w/k0Uopx+WjRk+KLb4yebPsIMUiFZTo+hmd8+eZrxZOkp X-Received: by 2002:a05:6830:4b1:: with SMTP id l17mr2771890otd.275.1584435110266; Tue, 17 Mar 2020 01:51:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1584435110; cv=none; d=google.com; s=arc-20160816; b=Z/uc+d62I0hq9uSMQ5f44tuOFdCcyy7ayEeS7WbHynkaBIXGLenmPehlMVycTwigXY xDwoX2MXNLAJALy7YuUhdW8e4ZTmKRA2wETEMToRp9T5eL2VEP1BF/cRuwiKzLxhdf4i ApvUPQy5z1DHmcks2CfbClcU2eS3LajWojD8QXUR9PoZwwdFPa9MF7c5Q+EDBffARNRN nz47INClbyHFJTDndXhdHjqc9tTiJjVE+khJQnCSSkMA8YJ0ahPXMhXxo7Rf1L4b9FG2 qqLCRqth9EL1dzClhLRqeybqci5VPWO8cnpVhDJnCClOAGKAIehjspO8QXxGk6A9GZF0 hCTQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=7DxT0CbRjnGUxR1++lWdDoDBZEsAmuWDpYSo3cb6OJQ=; b=pp2RrSZHMu0/B5ezsGG2twzOE1WAK1ARxEcMTq6euHX8wzJOJRCMApixg5PzoLN1Nh j5AhwvI1peMb0FuHMI5euxEzH70JUPZ/4HSDslDxN6XR2mJNI6PpTqq8T7CAn0UMFjgx 2o2LCUyY984FCtoAlOx1rdgz6rcfm2qugsbJ1fEvLPcaebhuSekR+aedRk3BL2g0VoOj /KF/e4I56SUQN263BqJhb0hMyBo5+Uaq2vt06f6u0Ea91p/jxyt7W1nNuGkNMoyL01Zm PqBBEzcqhoLqf++4Nbvb2clqOCxUfcVuXnaqHiXTgzJDm/7250tLK/LBqPWF/4IRySZq xxuA== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n6si1393212otf.147.2020.03.17.01.51.37; Tue, 17 Mar 2020 01:51:50 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726039AbgCQIvJ (ORCPT + 99 others); Tue, 17 Mar 2020 04:51:09 -0400 Received: from mx2.suse.de ([195.135.220.15]:38472 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725730AbgCQIvJ (ORCPT ); Tue, 17 Mar 2020 04:51:09 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id F0D9AAD94; Tue, 17 Mar 2020 08:51:05 +0000 (UTC) Subject: Re: [PATCH -V2] mm: Code cleanup for MADV_FREE To: "Huang, Ying" Cc: Andrew Morton , linux-mm@kvack.org, linux-kernel@vger.kernel.org, David Hildenbrand , Johannes Weiner , David Rientjes , Michal Hocko , Pankaj Gupta , Dave Hansen , Mel Gorman , Minchan Kim , Hugh Dickins , Rik van Riel References: <20200316063740.2542014-1-ying.huang@intel.com> <87v9n3qu4p.fsf@yhuang-dev.intel.com> From: Vlastimil Babka Message-ID: <29193b53-b83a-b595-3117-f8d10342a49a@suse.cz> Date: Tue, 17 Mar 2020 09:51:04 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.5.0 MIME-Version: 1.0 In-Reply-To: <87v9n3qu4p.fsf@yhuang-dev.intel.com> Content-Type: text/plain; charset=windows-1252 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 3/17/20 9:10 AM, Huang, Ying wrote: > Vlastimil Babka writes: > >> On 3/16/20 7:37 AM, Huang, Ying wrote: >>> From: Huang Ying >>> >>> Some comments for MADV_FREE is revised and added to help people understand the >>> MADV_FREE code, especially the page flag, PG_swapbacked. This makes >>> page_is_file_cache() isn't consistent with its comments. So the function is >>> renamed to page_is_file_lru() to make them consistent again. All these are put >>> in one patch as one logical change. >>> Signed-off-by: "Huang, Ying" >>> Suggested-by: David Hildenbrand >>> Suggested-by: Johannes Weiner >>> Suggested-and-acked-by: David Rientjes >>> Acked-by: Michal Hocko >>> Acked-by: Pankaj Gupta >>> Cc: Dave Hansen >>> Cc: Mel Gorman >>> Cc: Vlastimil Babka >>> Cc: Minchan Kim >>> Cc: Hugh Dickins >>> Cc: Rik van Riel >> >> Acked-by: Vlastimil Babka >> >> Thanks! A grammar nit below: >> >>> --- a/include/linux/mm_inline.h >>> +++ b/include/linux/mm_inline.h >>> @@ -6,19 +6,20 @@ >>> #include >>> >>> /** >>> - * page_is_file_cache - should the page be on a file LRU or anon LRU? >>> + * page_is_file_lru - 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 >> >> a lazily freed anonymous page (e.g. ... > > Thought again. Should we make the 2 sub-clauses consistent? That is, > either > > if @page is page cache page backed by a regular filesystem or anonymous > page freed lazily > > or > > if @page is a regular filesystem backed page cache page or a lazily > freed anonymous page Yeah this one looks fine :) > But I know that my English grammar isn't good enough :-( > > Best Regards, > Huang, Ying > >>> + * 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. >>> * >>> * We would like to get this info without a page flag, but the state >>> * needs to survive until the page is last deleted from the LRU, which >>> * could be as far down as __page_cache_release. >>> */ >>> -static inline int page_is_file_cache(struct page *page) >>> +static inline int page_is_file_lru(struct page *page) >>> { >>> return !PageSwapBacked(page); >>> } >