All of lore.kernel.org
 help / color / mirror / Atom feed
From: Kaixu Xia <xiakaixu1987@gmail.com>
To: SeongJae Park <sj@kernel.org>
Cc: akpm@linux-foundation.org, damon@lists.linux.dev,
	linux-mm@kvack.org,  LKML <linux-kernel@vger.kernel.org>,
	Kaixu Xia <kaixuxia@tencent.com>
Subject: Re: [PATCH] mm/damon: rename damon_pageout_score() to damon_cold_score()
Date: Sat, 17 Sep 2022 21:34:52 +0800	[thread overview]
Message-ID: <CAGjdHunWLqgkhCjsB6t3gV4fzVhBs6=Nj1va1sdCbrQ=Fyu53g@mail.gmail.com> (raw)
In-Reply-To: <20220917111230.114618-1-sj@kernel.org>

On Sat, Sep 17, 2022 at 7:12 PM SeongJae Park <sj@kernel.org> wrote:
>
> On Sat, 17 Sep 2022 17:39:18 +0800 xiakaixu1987@gmail.com wrote:
>
> > From: Kaixu Xia <kaixuxia@tencent.com>
> >
> > In the beginning there is only one damos_action 'DAMOS_PAGEOUT'
> > that need to get the coldness score of a region for a scheme,
> > which using damon_pageout_score() to do that. But now there are
> > also other damos_action actions need the coldness score, so
> > rename it to damon_cold_score() to make more sense.
>
> Good idea.
>
> >
> > Signed-off-by: Kaixu Xia <kaixuxia@tencent.com>
> > ---
> >  mm/damon/ops-common.c | 2 +-
> >  mm/damon/ops-common.h | 2 +-
> >  mm/damon/paddr.c      | 5 ++---
> >  mm/damon/vaddr.c      | 2 +-
> >  4 files changed, 5 insertions(+), 6 deletions(-)
> >
> > diff --git a/mm/damon/ops-common.c b/mm/damon/ops-common.c
> > index 9310df72e1c5..75409601f934 100644
> > --- a/mm/damon/ops-common.c
> > +++ b/mm/damon/ops-common.c
> > @@ -130,7 +130,7 @@ int damon_hot_score(struct damon_ctx *c, struct damon_region *r,
> >       return hotness;
> >  }
> >
> > -int damon_pageout_score(struct damon_ctx *c, struct damon_region *r,
> > +int damon_cold_score(struct damon_ctx *c, struct damon_region *r,
> >                       struct damos *s)
> >  {
> >       int hotness = damon_hot_score(c, r, s);
> > diff --git a/mm/damon/ops-common.h b/mm/damon/ops-common.h
> > index 52329ff361cd..8d82d3722204 100644
> > --- a/mm/damon/ops-common.h
> > +++ b/mm/damon/ops-common.h
> > @@ -12,7 +12,7 @@ struct page *damon_get_page(unsigned long pfn);
> >  void damon_ptep_mkold(pte_t *pte, struct mm_struct *mm, unsigned long addr);
> >  void damon_pmdp_mkold(pmd_t *pmd, struct mm_struct *mm, unsigned long addr);
> >
> > -int damon_pageout_score(struct damon_ctx *c, struct damon_region *r,
> > +int damon_cold_score(struct damon_ctx *c, struct damon_region *r,
> >                       struct damos *s);
> >  int damon_hot_score(struct damon_ctx *c, struct damon_region *r,
> >                       struct damos *s);
> > diff --git a/mm/damon/paddr.c b/mm/damon/paddr.c
> > index dfeebffe82f4..e495146e49e9 100644
> > --- a/mm/damon/paddr.c
> > +++ b/mm/damon/paddr.c
> > @@ -287,11 +287,10 @@ static int damon_pa_scheme_score(struct damon_ctx *context,
> >  {
> >       switch (scheme->action) {
> >       case DAMOS_PAGEOUT:
> > -             return damon_pageout_score(context, r, scheme);
> > +     case DAMOS_LRU_DEPRIO:
> > +             return damon_cold_score(context, r, scheme);
> >       case DAMOS_LRU_PRIO:
> >               return damon_hot_score(context, r, scheme);
> > -     case DAMOS_LRU_DEPRIO:
> > -             return damon_pageout_score(context, r, scheme);
>
> I'm not a big fan of switch-case fall-through, and want to keep the order of
> cases here more similar to that in damos_action definition.  Let's change only
> the function name.
>
Ok, I'll follow that in the next version.

Thanks,
Kaixu
> Other than that,
>
> Reviewed-by: SeongJae Park <sj@kernel.org>
>
>
> Thanks,
> SJ
>
> >       default:
> >               break;
> >       }
> > diff --git a/mm/damon/vaddr.c b/mm/damon/vaddr.c
> > index f53c2ff2bcc8..ea94e0b2c311 100644
> > --- a/mm/damon/vaddr.c
> > +++ b/mm/damon/vaddr.c
> > @@ -673,7 +673,7 @@ static int damon_va_scheme_score(struct damon_ctx *context,
> >
> >       switch (scheme->action) {
> >       case DAMOS_PAGEOUT:
> > -             return damon_pageout_score(context, r, scheme);
> > +             return damon_cold_score(context, r, scheme);
> >       default:
> >               break;
> >       }
> > --
> > 2.27.0
> >
> >

      reply	other threads:[~2022-09-17 13:35 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-17  9:39 [PATCH] mm/damon: rename damon_pageout_score() to damon_cold_score() xiakaixu1987
2022-09-17 11:12 ` SeongJae Park
2022-09-17 13:34   ` Kaixu Xia [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='CAGjdHunWLqgkhCjsB6t3gV4fzVhBs6=Nj1va1sdCbrQ=Fyu53g@mail.gmail.com' \
    --to=xiakaixu1987@gmail.com \
    --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=sj@kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.