From: SeongJae Park <sj@kernel.org>
To: JaeJoon Jung <rgbi3307@gmail.com>
Cc: SeongJae Park <sj@kernel.org>, damon@lists.linux.dev, linux-mm@kvack.org
Subject: Re: [PATCH] mm/damon: modified damon_call_control from static to kmalloc
Date: Sat, 6 Dec 2025 18:36:24 -0800 [thread overview]
Message-ID: <20251207023625.44177-1-sj@kernel.org> (raw)
In-Reply-To: <20251206224724.13832-1-rgbi3307@gmail.com>
On Sun, 7 Dec 2025 07:47:23 +0900 JaeJoon Jung <rgbi3307@gmail.com> wrote:
> The damon_call_control structure is used by all damon modules.
> In mm/damon/sysfs.c, it is dynamically allocated with kmalloc(),
It is only for refresh_ms handling damon_call_control.
damon_sysfs_damon_call() doesn't use kmalloc().
> and in
> the remaining modules, it is statically coded.
I try not to use dynamic allocation when possible and *reasonable*, since doing
so eliminates the chances of bugs from dynamic allocation handling mistakes.
> There are many daemon
> modules and they are designed to be used only when needed. It is more
> efficient to use kmalloc dynamically whenever needed as in damon/sysfs.c.
I agree that is more efficient in terms of kernel size. Nevertheless, I don't
think it is a significant improvement, since it is only single data structure
per the DAMON module. The total number of DAMON modules is only five. Two
among those are samples.
> Using damon_call_control dynamically and consistently has the advantage of
> eliminating the dealloc_on_cancel member variable condition and reducing
> code size.
Disadvantage of this change is that it is adding four more dynamic allocations
that we need to cautiously maintain. It is not significantly increasing the
maintenance overhead. But, the advantage (kernel size reduction) also seems
only modest, if I'm not wrong.
So I'm sadly have to say I don't think this change is really needed.
Please let me know if I'm missing something, though.
Thanks,
SJ
[...]
next prev parent reply other threads:[~2025-12-07 2:36 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-12-06 22:47 JaeJoon Jung
2025-12-07 2:36 ` SeongJae Park [this message]
2025-12-09 12:20 ` JaeJoon Jung
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=20251207023625.44177-1-sj@kernel.org \
--to=sj@kernel.org \
--cc=damon@lists.linux.dev \
--cc=linux-mm@kvack.org \
--cc=rgbi3307@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