[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20210805174304.3c3d8c8ee971bc9ddf6988af@linux-foundation.org>
Date: Thu, 5 Aug 2021 17:43:04 -0700
From: Andrew Morton <akpm@...ux-foundation.org>
To: SeongJae Park <sj38.park@...il.com>
Cc: SeongJae Park <sjpark@...zon.de>, Jonathan.Cameron@...wei.com,
acme@...nel.org, alexander.shishkin@...ux.intel.com,
amit@...nel.org, benh@...nel.crashing.org,
brendanhiggins@...gle.com, corbet@....net, david@...hat.com,
dwmw@...zon.com, elver@...gle.com, fan.du@...el.com,
foersleo@...zon.de, greg@...ah.com, gthelen@...gle.com,
guoju.fgj@...baba-inc.com, jgowans@...zon.com, joe@...ches.com,
mgorman@...e.de, mheyne@...zon.de, minchan@...nel.org,
mingo@...hat.com, namhyung@...nel.org, peterz@...radead.org,
riel@...riel.com, rientjes@...gle.com, rostedt@...dmis.org,
rppt@...nel.org, shakeelb@...gle.com, shuah@...nel.org,
sieberf@...zon.com, snu@...le79.org, vbabka@...e.cz,
vdavydov.dev@...il.com, zgf574564920@...il.com,
linux-damon@...zon.com, linux-mm@...ck.org,
linux-doc@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v34 07/13] mm/damon: Implement a debugfs-based user
space interface
On Fri, 16 Jul 2021 08:14:43 +0000 SeongJae Park <sj38.park@...il.com> wrote:
> From: SeongJae Park <sjpark@...zon.de>
>
> DAMON is designed to be used by kernel space code such as the memory
> management subsystems, and therefore it provides only kernel space API.
> That said, letting the user space control DAMON could provide some
> benefits to them. For example, it will allow user space to analyze
> their specific workloads and make their own special optimizations.
>
> For such cases, this commit implements a simple DAMON application kernel
> module, namely 'damon-dbgfs', which merely wraps the DAMON api and
> exports those to the user space via the debugfs.
>
> ...
>
> +static int __init damon_dbgfs_init(void)
> +{
> + int rc;
> +
> + dbgfs_ctxs = kmalloc(sizeof(*dbgfs_ctxs), GFP_KERNEL);
> + if (!dbgfs_ctxs) {
> + pr_err("%s: dbgfs ctxs alloc failed\n", __func__);
> + return -ENOMEM;
> + }
> + dbgfs_ctxs[0] = dbgfs_new_ctx();
> + if (!dbgfs_ctxs[0]) {
> + kfree(dbgfs_ctxs);
> + pr_err("%s: dbgfs ctx alloc failed\n", __func__);
> + return -ENOMEM;
> + }
checkpatch points out that the "alloc failed" messages are unneeded -
kmalloc(GFP_KERNEL) will have already emitted a stack trace. Is this
fixup OK?
--- a/mm/damon/dbgfs.c~mm-damon-implement-a-debugfs-based-user-space-interface-fix
+++ a/mm/damon/dbgfs.c
@@ -373,14 +373,11 @@ static int __init damon_dbgfs_init(void)
int rc;
dbgfs_ctxs = kmalloc(sizeof(*dbgfs_ctxs), GFP_KERNEL);
- if (!dbgfs_ctxs) {
- pr_err("%s: dbgfs ctxs alloc failed\n", __func__);
+ if (!dbgfs_ctxs)
return -ENOMEM;
- }
dbgfs_ctxs[0] = dbgfs_new_ctx();
if (!dbgfs_ctxs[0]) {
kfree(dbgfs_ctxs);
- pr_err("%s: dbgfs ctx alloc failed\n", __func__);
return -ENOMEM;
}
dbgfs_nr_ctxs = 1;
_
Powered by blists - more mailing lists