Re: [RFC PATCH 3/3] mm: compaction: Fix the migration stats in trace_mm_compaction_migratepages()
From: Steven Rostedt
Date: Wed Nov 03 2021 - 09:42:37 EST
On Wed, 3 Nov 2021 18:51:16 +0800
Baolin Wang <baolin.wang@xxxxxxxxxxxxxxxxx> wrote:
> @@ -2398,10 +2399,10 @@ bool compaction_zonelist_suitable(struct alloc_context *ac, int order,
>
> err = migrate_pages(&cc->migratepages, compaction_alloc,
> compaction_free, (unsigned long)cc, cc->mode,
> - MR_COMPACTION, NULL);
> + MR_COMPACTION, &nr_succeeded);
>
> - trace_mm_compaction_migratepages(cc->nr_migratepages, err,
> - &cc->migratepages);
> + trace_mm_compaction_migratepages(cc->nr_migratepages,
> + nr_succeeded);
Also, I'm surprised you don't just pass in 'cc' and do the dereferencing in
the trace event macro. Accessing the pointers from the trace event and not
dereferencing them to the tracepoint function moves the changes out of line
here and helps with I$.
You could improve some of the other tracepoints that dereference 'cc' as
well in that file.
But as for this change, I'm good with it.
For the tracing aspect:
Reviewed-by: Steven Rostedt (VMware) <rostedt@xxxxxxxxxxx>
-- Steve
>
> /* All pages were either migrated or will be released */
> cc->nr_migratepages = 0;