linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: SeongJae Park <sj@kernel.org>
To: Huan Yang <link@vivo.com>
Cc: SeongJae Park <sj@kernel.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	damon@lists.linux.dev, linux-mm@kvack.org,
	linux-kernel@vger.kernel.org, opensource.kernel@vivo.com
Subject: Re: [PATCH v3] mm/damon/core: remove unnecessary si_meminfo invoke.
Date: Wed, 20 Sep 2023 07:19:49 +0000	[thread overview]
Message-ID: <20230920071949.26063-1-sj@kernel.org> (raw)
In-Reply-To: <20230920015727.4482-1-link@vivo.com>

Hi Huan,

On Wed, 20 Sep 2023 09:57:27 +0800 Huan Yang <link@vivo.com> wrote:

> si_meminfo() will read and assign more info not just free/ram pages.
> For just DAMOS_WMARK_FREE_MEM_RATE use, only get free and ram pages
> is ok to save cpu.
> 
> Signed-off-by: Huan Yang <link@vivo.com>

Reviewed-by: SeongJae Park <sj@kernel.org>


Thanks,
SJ

> ---
> Change from v1:
> v1 fold free mem rate logic into __damos_get_wmark_free_mem_rate and not
> invoke si_meminfo, just get free/ram_pages in global.
> v2 cancel this __damos_get_wmark_free_mem_rate and just calculate rate
> in damos_wmark_metric_value to keep it simple.
> v3 fix changelog format, fix code style.
> 
> 
>  mm/damon/core.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/mm/damon/core.c b/mm/damon/core.c
> index bcd2bd9d6c10..6ceb52298904 100644
> --- a/mm/damon/core.c
> +++ b/mm/damon/core.c
> @@ -1280,12 +1280,10 @@ static bool kdamond_need_stop(struct damon_ctx *ctx)
>  
>  static unsigned long damos_wmark_metric_value(enum damos_wmark_metric metric)
>  {
> -	struct sysinfo i;
> -
>  	switch (metric) {
>  	case DAMOS_WMARK_FREE_MEM_RATE:
> -		si_meminfo(&i);
> -		return i.freeram * 1000 / i.totalram;
> +		return global_zone_page_state(NR_FREE_PAGES) * 1000 /
> +		       totalram_pages();
>  	default:
>  		break;
>  	}
> -- 
> 2.34.1


           reply	other threads:[~2023-09-20  7:20 UTC|newest]

Thread overview: expand[flat|nested]  mbox.gz  Atom feed
 [parent not found: <20230920015727.4482-1-link@vivo.com>]

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=20230920071949.26063-1-sj@kernel.org \
    --to=sj@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=damon@lists.linux.dev \
    --cc=link@vivo.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=opensource.kernel@vivo.com \
    /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).