linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Kairui Song <ryncsn@gmail.com>
To: Chris Li <chrisl@kernel.org>
Cc: linux-mm@kvack.org, Andrew Morton <akpm@linux-foundation.org>,
	 Yu Zhao <yuzhao@google.com>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/3] mm, lru_gen: batch update counters on againg
Date: Wed, 27 Dec 2023 18:22:46 +0800	[thread overview]
Message-ID: <CAMgjq7Dzf48pu5mJQFdqLxW9c=1N0jC4u53xY3fALBvv9Yrq1g@mail.gmail.com> (raw)
In-Reply-To: <CAF8kJuNPCvNyjy71Q9Kncq26ndAwSWhVH1cJ8s=1Exr=AmLgSA@mail.gmail.com>

Chris Li <chrisl@kernel.org> 于2023年12月27日周三 07:43写道:
>
> Hi Kairui,
>
> Some early feedback on your patch. I am still working  my way through
> your patches.
> Might have more questions.

Hi Chris,

Thanks for the review.

> On Fri, Dec 22, 2023 at 2:24 AM Kairui Song <ryncsn@gmail.com> wrote:
> >
> > From: Kairui Song <kasong@tencent.com>
> >
> > When lru_gen is aging, it will update mm counters page by page,
> > which causes a higher overhead if age happens frequently or there
> > are a lot of pages in one generation getting moved.
> > Optimize this by doing the counter update in batch.
> >
> > Although most __mod_*_state has its own caches the overhead
> > is still observable.
> >
> > Tested in a 4G memcg on a EPYC 7K62 with:
> >
> >   memcached -u nobody -m 16384 -s /tmp/memcached.socket \
> >     -a 0766 -t 16 -B binary &
> >
> >   memtier_benchmark -S /tmp/memcached.socket \
> >     -P memcache_binary -n allkeys \
> >     --key-minimum=1 --key-maximum=16000000 -d 1024 \
> >     --ratio=1:0 --key-pattern=P:P -c 2 -t 16 --pipeline 8 -x 6
> >
> > Average result of 18 test runs:
> >
> > Before: 44017.78 Ops/sec
> > After:  44687.08 Ops/sec (+1.5%)
> >
> > Signed-off-by: Kairui Song <kasong@tencent.com>
> > ---
> >  mm/vmscan.c | 64 +++++++++++++++++++++++++++++++++++++++++++++--------
> >  1 file changed, 55 insertions(+), 9 deletions(-)
> >
> > diff --git a/mm/vmscan.c b/mm/vmscan.c
> > index b4ca3563bcf4..e3b4797b9729 100644
> > --- a/mm/vmscan.c
> > +++ b/mm/vmscan.c
> > @@ -3095,9 +3095,47 @@ static int folio_update_gen(struct folio *folio, int gen)
> >         return ((old_flags & LRU_GEN_MASK) >> LRU_GEN_PGOFF) - 1;
> >  }
> >
> > +/*
> > + * Update LRU gen in batch for each lru_gen LRU list. The batch is limited to
> > + * each gen / type / zone level LRU. Batch is applied after finished or aborted
> > + * scanning one LRU list.
> > + */
> > +struct gen_update_batch {
> > +       int delta[MAX_NR_GENS];
> > +};
> > +
> > +static void lru_gen_update_batch(struct lruvec *lruvec, bool type, int zone,
> "type" need to be int, it is either  LRU_GEN_FILE or LRU_GEN_ANON.

Yes, I'll update it with some more test results later.


  reply	other threads:[~2023-12-27 10:23 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-22 10:22 [PATCH 0/3] mm, lru_gen: batch update pages when aging Kairui Song
2023-12-22 10:22 ` [PATCH 1/3] mm, lru_gen: batch update counters on againg Kairui Song
2023-12-25  7:28   ` Yu Zhao
2023-12-26 23:43   ` Chris Li
2023-12-27 10:22     ` Kairui Song [this message]
2023-12-22 10:22 ` [PATCH 2/3] mm, lru_gen: move pages in bulk when aging Kairui Song
2023-12-23  7:36   ` kernel test robot
2023-12-25  6:58   ` Yu Zhao
2023-12-25  7:01     ` Kairui Song
2023-12-22 10:22 ` [PATCH 3/3] mm, lru_gen: try to prefetch next page when canning LRU Kairui Song
2023-12-25  6:41   ` Yu Zhao
2023-12-25  6:54     ` Yu Zhao
2023-12-25 15:42     ` Matthew Wilcox
2023-12-26 22:12       ` Suren Baghdasaryan

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='CAMgjq7Dzf48pu5mJQFdqLxW9c=1N0jC4u53xY3fALBvv9Yrq1g@mail.gmail.com' \
    --to=ryncsn@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=chrisl@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=yuzhao@google.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