linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Vlastimil Babka <vbabka@suse.cz>
To: Fengguang Wu <fengguang.wu@intel.com>,
	Linux Memory Management List <linux-mm@kvack.org>,
	Andrew Morton <akpm@linux-foundation.org>
Cc: Dave Hansen <dave.hansen@intel.com>,
	Liu Jingqi <jingqi.liu@intel.com>,
	LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] mm: trivial mark_page_accessed() cleanup
Date: Tue, 22 Oct 2019 13:53:23 +0200	[thread overview]
Message-ID: <1e12400d-80c7-33a0-051d-85976b6d3fad@suse.cz> (raw)
In-Reply-To: <20191016225326.GB12497@wfg-t540p.sh.intel.com>

On 10/17/19 12:53 AM, Fengguang Wu wrote:
> This avoids duplicated PageReferenced() calls.
> No behavior change.
> 
> Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>

Acked-by: Vlastimil Babka <vbabka@suse.cz>

> ---
>   mm/swap.c | 14 +++++++++-----
>   1 file changed, 9 insertions(+), 5 deletions(-)
> 
> diff --git a/mm/swap.c b/mm/swap.c
> index 38a52b9..c55720c 100644
> --- a/mm/swap.c
> +++ b/mm/swap.c
> @@ -373,9 +373,15 @@ void mark_page_accessed(struct page *page)
>   	page = compound_head(page);
>   	inc_node_page_state(page, NR_ACCESSED);
>   
> -	if (!PageActive(page) && !PageUnevictable(page) &&
> -			PageReferenced(page)) {
> -
> +	if (!PageReferenced(page)) {
> +		SetPageReferenced(page);
> +	} else if (PageUnevictable(page)) {
> +		/*
> +		 * Unevictable pages are on the "LRU_UNEVICTABLE" list. But,
> +		 * this list is never rotated or maintained, so marking an
> +		 * evictable page accessed has no effect.
> +		 */
> +	} else if (!PageActive(page)) {
>   		/*
>   		 * If the page is on the LRU, queue it for activation via
>   		 * activate_page_pvecs. Otherwise, assume the page is on a
> @@ -389,8 +395,6 @@ void mark_page_accessed(struct page *page)
>   		ClearPageReferenced(page);
>   		if (page_is_file_cache(page))
>   			workingset_activation(page);
> -	} else if (!PageReferenced(page)) {
> -		SetPageReferenced(page);
>   	}
>   	if (page_is_idle(page))
>   		clear_page_idle(page);
> 



      reply	other threads:[~2019-10-22 11:53 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-16 22:53 Fengguang Wu
2019-10-22 11:53 ` Vlastimil Babka [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1e12400d-80c7-33a0-051d-85976b6d3fad@suse.cz \
    --to=vbabka@suse.cz \
    --cc=akpm@linux-foundation.org \
    --cc=dave.hansen@intel.com \
    --cc=fengguang.wu@intel.com \
    --cc=jingqi.liu@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox