From: SeongJae Park <sj@kernel.org>
To: Xin Hao <xhao@linux.alibaba.com>
Cc: sj@kernel.org, akpm@linux-foundation.org, linux-mm@kvack.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH V1 1/2] mm/damon/dbgfs: Put "paddr" check into damon_pa_check() func
Date: Thu, 20 Jan 2022 17:47:16 +0000 [thread overview]
Message-ID: <20220120174717.26158-1-sj@kernel.org> (raw)
In-Reply-To: <44060c744a3760b1ecf6ce52a9b4ec842fa55eef.1642722660.git.xhao@linux.alibaba.com>
Hi Xin,
On Fri, 21 Jan 2022 00:04:27 +0800 Xin Hao <xhao@linux.alibaba.com> wrote:
> The purpose of putting "paddr" check into damon_pa_check() func
> is to better solve "DAMON_DBGFS" dependency on both "DAMON_VADDR"
> and "DAMON_PADDR".
Syntax of "paddr" is dbgfs's own. I don't think handling it in paddr is a
right thing to do.
Thanks,
SJ
>
> Signed-off-by: Xin Hao <xhao@linux.alibaba.com>
> ---
> include/linux/damon.h | 1 +
> mm/damon/dbgfs.c | 2 +-
> mm/damon/paddr.c | 8 ++++++++
> 3 files changed, 10 insertions(+), 1 deletion(-)
>
> diff --git a/include/linux/damon.h b/include/linux/damon.h
> index 5e1e3a128b77..794b5f453662 100644
> --- a/include/linux/damon.h
> +++ b/include/linux/damon.h
> @@ -504,6 +504,7 @@ void damon_va_set_primitives(struct damon_ctx *ctx);
> #endif /* CONFIG_DAMON_VADDR */
>
> #ifdef CONFIG_DAMON_PADDR
> +bool damon_pa_check(char *buf, size_t count);
> bool damon_pa_target_valid(void *t);
> void damon_pa_set_primitives(struct damon_ctx *ctx);
> #endif /* CONFIG_DAMON_PADDR */
> diff --git a/mm/damon/dbgfs.c b/mm/damon/dbgfs.c
> index 5b899601e56c..cdb9c1e2ab29 100644
> --- a/mm/damon/dbgfs.c
> +++ b/mm/damon/dbgfs.c
> @@ -374,7 +374,7 @@ static ssize_t dbgfs_target_ids_write(struct file *file,
> if (IS_ERR(kbuf))
> return PTR_ERR(kbuf);
>
> - if (!strncmp(kbuf, "paddr\n", count)) {
> + if (damon_pa_check(kbuf, count)) {
> id_is_pid = false;
> /* target id is meaningless here, but we set it just for fun */
> scnprintf(kbuf, count, "42 ");
> diff --git a/mm/damon/paddr.c b/mm/damon/paddr.c
> index 5e8244f65a1a..14a6bf2a2adb 100644
> --- a/mm/damon/paddr.c
> +++ b/mm/damon/paddr.c
> @@ -208,6 +208,14 @@ static unsigned int damon_pa_check_accesses(struct damon_ctx *ctx)
> return max_nr_accesses;
> }
>
> +bool damon_pa_check(char *buf, size_t count)
> +{
> + if (!strncmp(buf, "paddr\n", count))
> + return true;
> +
> + return false;
> +}
> +
> bool damon_pa_target_valid(void *t)
> {
> return true;
> --
> 2.27.0
>
>
next prev parent reply other threads:[~2022-01-20 17:47 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <cover.1642722660.git.xhao@linux.alibaba.com>
2022-01-20 16:04 ` [PATCH V1 1/2] mm/damon/dbgfs: Put "paddr" check into damon_pa_check() func Xin Hao
2022-01-20 17:47 ` SeongJae Park [this message]
2022-01-20 16:04 ` [PATCH V1 2/2] mm/damon/dbgfs: Modify Damon dbfs interface dependency in Kconfig Xin Hao
2022-01-20 17:46 ` SeongJae Park
2022-01-21 2:14 ` Xin Hao
2022-01-21 9:45 ` SeongJae Park
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=20220120174717.26158-1-sj@kernel.org \
--to=sj@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=xhao@linux.alibaba.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).