linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: SeongJae Park <sj@kernel.org>
To: xiakaixu1987@gmail.com
Cc: sj@kernel.org, akpm@linux-foundation.org, damon@lists.linux.dev,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org,
	Kaixu Xia <kaixuxia@tencent.com>
Subject: Re: [PATCH 1/2] mm/damon: simplify the parameter passing for 'check_accesses'
Date: Fri, 26 Aug 2022 17:08:18 +0000	[thread overview]
Message-ID: <20220826170818.50050-1-sj@kernel.org> (raw)
In-Reply-To: <1661502678-19336-2-git-send-email-kaixuxia@tencent.com>

Hi Kaixu,

On Fri, 26 Aug 2022 16:31:17 +0800 xiakaixu1987@gmail.com wrote:

> From: Kaixu Xia <kaixuxia@tencent.com>
> 
> The parameter 'struct damon_ctx *ctx' is unnecessary in damon
> 'check_accesses' callback operation, so we can remove it.

Thank you for the finding, but this wording is not 100% perfect, strictly
speaking.  The callback operations indeed use the parameter, but the internal
functions called by the callbacks (__damon_{p,v}a_check_access()) aren't.

Could you please update the message?

> 
> Signed-off-by: Kaixu Xia <kaixuxia@tencent.com>
> ---
>  mm/damon/paddr.c | 5 ++---
>  mm/damon/vaddr.c | 5 ++---
>  2 files changed, 4 insertions(+), 6 deletions(-)
> 
> diff --git a/mm/damon/paddr.c b/mm/damon/paddr.c
> index dc131c6a5403..6b0d9e6aa677 100644
> --- a/mm/damon/paddr.c
> +++ b/mm/damon/paddr.c
> @@ -166,8 +166,7 @@ static bool damon_pa_young(unsigned long paddr, unsigned long *page_sz)
>  	return result.accessed;
>  }
>  
> -static void __damon_pa_check_access(struct damon_ctx *ctx,
> -				    struct damon_region *r)
> +static void __damon_pa_check_access(struct damon_region *r)
>  {
>  	static unsigned long last_addr;
>  	static unsigned long last_page_sz = PAGE_SIZE;
> @@ -196,7 +195,7 @@ static unsigned int damon_pa_check_accesses(struct damon_ctx *ctx)
>  
>  	damon_for_each_target(t, ctx) {
>  		damon_for_each_region(r, t) {
> -			__damon_pa_check_access(ctx, r);
> +			__damon_pa_check_access(r);
>  			max_nr_accesses = max(r->nr_accesses, max_nr_accesses);
>  		}
>  	}
> diff --git a/mm/damon/vaddr.c b/mm/damon/vaddr.c
> index 3c7b9d6dca95..c8c2f306bb6d 100644
> --- a/mm/damon/vaddr.c
> +++ b/mm/damon/vaddr.c
> @@ -532,8 +532,7 @@ static bool damon_va_young(struct mm_struct *mm, unsigned long addr,
>   * mm	'mm_struct' for the given virtual address space
>   * r	the region to be checked
>   */
> -static void __damon_va_check_access(struct damon_ctx *ctx,
> -			       struct mm_struct *mm, struct damon_region *r)
> +static void __damon_va_check_access(struct mm_struct *mm, struct damon_region *r)

I still prefer 80 columns rule[1].  Could you please break this line?


[1] https://docs.kernel.org/process/coding-style.html#breaking-long-lines-and-strings

>  {
>  	static struct mm_struct *last_mm;
>  	static unsigned long last_addr;
> @@ -568,7 +567,7 @@ static unsigned int damon_va_check_accesses(struct damon_ctx *ctx)
>  		if (!mm)
>  			continue;
>  		damon_for_each_region(r, t) {
> -			__damon_va_check_access(ctx, mm, r);
> +			__damon_va_check_access(mm, r);
>  			max_nr_accesses = max(r->nr_accesses, max_nr_accesses);
>  		}
>  		mmput(mm);
> -- 
> 2.27.0


Thanks,
SJ


  reply	other threads:[~2022-08-26 17:08 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-26  8:31 [PATCH 0/2] Simplify the damon regions access check xiakaixu1987
2022-08-26  8:31 ` [PATCH 1/2] mm/damon: simplify the parameter passing for 'check_accesses' xiakaixu1987
2022-08-26 17:08   ` SeongJae Park [this message]
2022-08-26 20:32     ` Kaixu Xia
2022-08-26  8:31 ` [PATCH 2/2] mm/damon/vaddr: remove comparison between mm and last_mm when checking region accesses xiakaixu1987
2022-08-26 17:16   ` SeongJae Park
2022-08-26 21:06     ` Kaixu Xia

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=20220826170818.50050-1-sj@kernel.org \
    --to=sj@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=damon@lists.linux.dev \
    --cc=kaixuxia@tencent.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=xiakaixu1987@gmail.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).