mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] mm/damon/core: use list_{next,prev}_entry() in damon_{next,prev}_region()
@ 2026-11-03 10:07 Enze Li
  2026-11-03 10:31 ` Aveline Noir
  2026-11-03 14:36 ` SJ Park
  0 siblings, 2 replies; 4+ messages in thread
From: Enze Li @ 2026-11-03 10:07 UTC (permalink / raw)
  To: sj; +Cc: damon, linux-mm, linux-kernel, lienze, enze.li

damon_next_region() and damon_prev_region() manually do container_of()
type casting to fetch the next and previous region from the linked
list.  Use the dedicated list.h helpers, list_next_entry() and
list_prev_entry(), as damon_first_region() and damon_last_region() do.

Signed-off-by: Enze Li <lienze@kylinos.cn>
---
 include/linux/damon.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/linux/damon.h b/include/linux/damon.h
index 380f9cf6ddd8..2ba43257e043 100644
--- a/include/linux/damon.h
+++ b/include/linux/damon.h
@@ -988,12 +988,12 @@ static inline unsigned long damon_rand(struct damon_ctx *ctx,
 
 static inline struct damon_region *damon_next_region(struct damon_region *r)
 {
-	return container_of(r->list.next, struct damon_region, list);
+	return list_next_entry(r, list);
 }
 
 static inline struct damon_region *damon_prev_region(struct damon_region *r)
 {
-	return container_of(r->list.prev, struct damon_region, list);
+	return list_prev_entry(r, list);
 }
 
 static inline struct damon_region *damon_last_region(struct damon_target *t)

base-commit: 74d73ffcffe03804f97e9fb82301dadf75671282
-- 
2.56.0


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

end of thread, other threads:[~2026-11-03 14:45 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-03 10:07 [PATCH] mm/damon/core: use list_{next,prev}_entry() in damon_{next,prev}_region() Enze Li
2026-11-03 10:31 ` Aveline Noir
2026-11-03 14:45   ` SJ Park
2026-11-03 14:36 ` SJ Park

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®