* [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
* Re: [PATCH] mm/damon/core: use list_{next,prev}_entry() in damon_{next,prev}_region()
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
1 sibling, 1 reply; 4+ messages in thread
From: Aveline Noir @ 2026-11-03 10:31 UTC (permalink / raw)
To: Enze Li; +Cc: damon, enze.li, linux-kernel, linux-mm, sj
Hi Enze,
On Tue, 03 Nov 2026 18:07:14 +0800 Enze Li wrote:
> 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.
The change looks correct to me. list_{next,prev}_entry() expand to the
same container_of() calls, so there is no functional change.
That said, my understanding is that the kernel generally discourages
changes made only for coding style, outside of other work on the same
code. Documentation/process/4.Coding.rst notes that "pure coding style
fixes are seen as noise by the development community".
SJ, what do you think about this kind of cleanup for DAMON?
Thanks,
Aveline Noir
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] mm/damon/core: use list_{next,prev}_entry() in damon_{next,prev}_region()
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:36 ` SJ Park
1 sibling, 0 replies; 4+ messages in thread
From: SJ Park @ 2026-11-03 14:36 UTC (permalink / raw)
To: Enze Li; +Cc: SJ Park, damon, linux-mm, linux-kernel, enze.li
On Tue, 3 Nov 2026 18:07:14 +0800 Enze Li <lienze@kylinos.cn> wrote:
> 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.
Looks good to me.
>
> Signed-off-by: Enze Li <lienze@kylinos.cn>
Reviewed-by: SJ Park <sj@kernel.org>
This patch is applied to damon/next [1] tree. I will repost it soon (~1 week)
as an mm.git merge request. So, no action from your side is needed for now.
[1] https://origin.kernel.org/doc/html/latest/mm/damon/maintainer-profile.html#scm-trees
Thanks,
SJ
[...]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] mm/damon/core: use list_{next,prev}_entry() in damon_{next,prev}_region()
2026-11-03 10:31 ` Aveline Noir
@ 2026-11-03 14:45 ` SJ Park
0 siblings, 0 replies; 4+ messages in thread
From: SJ Park @ 2026-11-03 14:45 UTC (permalink / raw)
To: Aveline Noir; +Cc: SJ Park, Enze Li, damon, enze.li, linux-kernel, linux-mm
On Tue, 03 Nov 2026 21:31:41 +1100 Aveline Noir <jm5905938@gmail.com> wrote:
> Hi Enze,
>
> On Tue, 03 Nov 2026 18:07:14 +0800 Enze Li wrote:
>
> > 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.
>
> The change looks correct to me. list_{next,prev}_entry() expand to the
> same container_of() calls, so there is no functional change.
>
> That said, my understanding is that the kernel generally discourages
> changes made only for coding style, outside of other work on the same
> code. Documentation/process/4.Coding.rst notes that "pure coding style
> fixes are seen as noise by the development community".
>
> SJ, what do you think about this kind of cleanup for DAMON?
I think whether it is noise or not depend on each change and the volume of
traffic. Let's suppose a patch for a real trivial change and there are many
patches for critical bug fixes waiting for reviews. In the case, I think the
trivial patch should be deprioritized, and we should discourage sending such
patches while the urgent reviews are done. If there are bandiwdth for review,
it is no problem. Nonetheless, I would dislike patches that making only
trivial cosmetic changes that doesn't really improve maintainability.
I feel like we have review bandwidth now, and this change looks like a
meaningful code maintainability improvement to me.
Thanks,
SJ
[...]
^ 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®