linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mm/damon: move the implementation of damon_insert_region to damon.h
@ 2021-12-23  8:57 Guoqing Jiang
  2021-12-23 12:10 ` SeongJae Park
  0 siblings, 1 reply; 2+ messages in thread
From: Guoqing Jiang @ 2021-12-23  8:57 UTC (permalink / raw)
  To: sj, akpm; +Cc: linux-mm, Guoqing Jiang

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



^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-12-23 12:10 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-12-23  8:57 [PATCH] mm/damon: move the implementation of damon_insert_region to damon.h Guoqing Jiang
2021-12-23 12:10 ` SeongJae Park

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).