linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: Dawei Li <set_pte_at@outlook.com>
Cc: sj@kernel.org, damon@lists.linux.dev, linux-mm@kvack.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] mm/damon: improve damon_new_region strategy
Date: Mon, 12 Sep 2022 12:26:39 -0700	[thread overview]
Message-ID: <20220912122639.6c8363ee79f3313299c9446f@linux-foundation.org> (raw)
In-Reply-To: <TYCP286MB2323DA1894FA55BB9CF90978CA449@TYCP286MB2323.JPNP286.PROD.OUTLOOK.COM>

On Mon, 12 Sep 2022 22:39:03 +0800 Dawei Li <set_pte_at@outlook.com> wrote:

> Kdamond is implemented as a periodical split-merge pattern, which will
> create and destroy regions possibly on high frequency(hundreds or even
> thousands of per sec), depending on number of regions and aggregation
> period.  In that case, kmalloc and kfree could bring considerable overhead
> to system, which can be improved by private kmem cache.
> 

A dedicated slab cache should be faster and will also consume less
memory, due to better packing into the underlying pages.  So I redid
the changelog thusly:

: Kdamond is implemented as a periodical split-merge pattern, which will
: create and destroy regions possibly at high frequency (hundreds or even
: thousands of per sec), depending on the number of regions and aggregation
: period.  In that case, kmalloc and kfree could bring speed and space
: overheads, which can be improved by using a private kmem cache.

> +static int __init damon_init(void)
> +{
> +	damon_region_cache = kmem_cache_create("damon_region_cache", sizeof(struct damon_region),

Should be able to use just

	damon_region_cache = KMEM_CACHE(damon_region, 0);

here.  Please test that and send along a fixup patch?



      reply	other threads:[~2022-09-12 19:26 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-12 14:39 [PATCH] mm/damon: improve damon_new_region strategy Dawei Li
2022-09-12 19:26 ` Andrew Morton [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=20220912122639.6c8363ee79f3313299c9446f@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=damon@lists.linux.dev \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=set_pte_at@outlook.com \
    --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 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).