From: Guoqing Jiang <guoqing.jiang@linux.dev>
To: sj@kernel.org, akpm@linux-foundation.org
Cc: linux-mm@kvack.org, Guoqing Jiang <guoqing.jiang@linux.dev>
Subject: [PATCH] mm/damon: move the implementation of damon_insert_region to damon.h
Date: Thu, 23 Dec 2021 16:57:03 +0800 [thread overview]
Message-ID: <20211223085703.6142-1-guoqing.jiang@linux.dev> (raw)
Usually, inline function is declared static since it should sit between
storage and type. And implement it in a header file if used by multiple
files.
And this change also fixes compile issue when backport damon to 5.10.
mm/damon/vaddr.c: In function ‘damon_va_evenly_split_region’:
./include/linux/damon.h:425:13: error: inlining failed in call to ‘always_inline’ ‘damon_insert_region’: function body not available
425 | inline void damon_insert_region(struct damon_region *r,
| ^~~~~~~~~~~~~~~~~~~
mm/damon/vaddr.c:86:3: note: called from here
86 | damon_insert_region(n, r, next, t);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Signed-off-by: Guoqing Jiang <guoqing.jiang@linux.dev>
---
include/linux/damon.h | 13 +++++++++++--
mm/damon/core.c | 11 -----------
2 files changed, 11 insertions(+), 13 deletions(-)
diff --git a/include/linux/damon.h b/include/linux/damon.h
index b4d4be3cc987..c0b03a8ef0d7 100644
--- a/include/linux/damon.h
+++ b/include/linux/damon.h
@@ -422,9 +422,18 @@ struct damon_ctx {
#ifdef CONFIG_DAMON
struct damon_region *damon_new_region(unsigned long start, unsigned long end);
-inline void damon_insert_region(struct damon_region *r,
+
+/*
+ * Add a region between two other regions
+ */
+static inline void damon_insert_region(struct damon_region *r,
struct damon_region *prev, struct damon_region *next,
- struct damon_target *t);
+ struct damon_target *t)
+{
+ __list_add(&r->list, &prev->list, &next->list);
+ t->nr_regions++;
+}
+
void damon_add_region(struct damon_region *r, struct damon_target *t);
void damon_destroy_region(struct damon_region *r, struct damon_target *t);
diff --git a/mm/damon/core.c b/mm/damon/core.c
index e92497895202..01f6347385b4 100644
--- a/mm/damon/core.c
+++ b/mm/damon/core.c
@@ -53,17 +53,6 @@ struct damon_region *damon_new_region(unsigned long start, unsigned long end)
return region;
}
-/*
- * Add a region between two other regions
- */
-inline void damon_insert_region(struct damon_region *r,
- struct damon_region *prev, struct damon_region *next,
- struct damon_target *t)
-{
- __list_add(&r->list, &prev->list, &next->list);
- t->nr_regions++;
-}
-
void damon_add_region(struct damon_region *r, struct damon_target *t)
{
list_add_tail(&r->list, &t->regions_list);
--
2.26.2
next reply other threads:[~2021-12-23 8:57 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-12-23 8:57 Guoqing Jiang [this message]
2021-12-23 12:10 ` [PATCH] mm/damon: move the implementation of damon_insert_region to damon.h 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=20211223085703.6142-1-guoqing.jiang@linux.dev \
--to=guoqing.jiang@linux.dev \
--cc=akpm@linux-foundation.org \
--cc=linux-mm@kvack.org \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.