linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Matthew Wilcox <willy@infradead.org>
To: yang.yang29@zte.com.cn
Cc: akpm@linux-foundation.org, hannes@cmpxchg.org,
	linux-kernel@vger.kernel.org, linux-mm@kvack.org,
	iamjoonsoo.kim@lge.com
Subject: Re:  [PATCH linux-next] mm: workingset: simplify the calculation of workingset size
Date: Thu, 16 Mar 2023 13:14:05 +0000	[thread overview]
Message-ID: <ZBMWHUJfFnIX7F9y@casper.infradead.org> (raw)
In-Reply-To: <202303161723055514455@zte.com.cn>

On Thu, Mar 16, 2023 at 05:23:05PM +0800, yang.yang29@zte.com.cn wrote:
>  	 * Compare the distance to the existing workingset size. We
>  	 * don't activate pages that couldn't stay resident even if
> -	 * all the memory was available to the workingset. Whether
> -	 * workingset competition needs to consider anon or not depends
> -	 * on having swap.
> +	 * all the memory was available to the workingset. For page
> +	 * cache whether workingset competition needs to consider
> +	 * anon or not depends on having swap.

I don't mind this change

>  	 */
>  	workingset_size = lruvec_page_state(eviction_lruvec, NR_ACTIVE_FILE);
> +	/* For anonymous page */

This comment adds no value

>  	if (!file) {
> +		workingset_size += lruvec_page_state(eviction_lruvec,
> +						     NR_ACTIVE_ANON);
>  		workingset_size += lruvec_page_state(eviction_lruvec,
>  						     NR_INACTIVE_FILE);
> -	}
> -	if (mem_cgroup_get_nr_swap_pages(eviction_memcg) > 0) {
> +	/* For page cache */

Nor this one

> +	} else if (mem_cgroup_get_nr_swap_pages(eviction_memcg) > 0) {
>  		workingset_size += lruvec_page_state(eviction_lruvec,
>  						     NR_ACTIVE_ANON);
> -		if (file) {
> -			workingset_size += lruvec_page_state(eviction_lruvec,
> +		workingset_size += lruvec_page_state(eviction_lruvec,
>  						     NR_INACTIVE_ANON);
> -		}
>  	}

I don't have an opinion on the actual code changes.


  reply	other threads:[~2023-03-16 13:14 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-16  9:23 [PATCH linux-next] mm: workingset: simplify the calculation of workingset size yang.yang29
2023-03-16 13:14 ` Matthew Wilcox [this message]
2023-03-16 14:30 ` Johannes Weiner
     [not found]   ` <20230317015903.16978-1-yang.yang29@zte.com.cn>
2023-03-17 14:09     ` Johannes Weiner

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=ZBMWHUJfFnIX7F9y@casper.infradead.org \
    --to=willy@infradead.org \
    --cc=akpm@linux-foundation.org \
    --cc=hannes@cmpxchg.org \
    --cc=iamjoonsoo.kim@lge.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=yang.yang29@zte.com.cn \
    /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;
as well as URLs for NNTP newsgroup(s).