Message ID | 1551501538-4092-2-git-send-email-laoar.shao@gmail.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | mm: compaction: some tracepoints should be defined only when CONFIG_COMPACTION is set | expand |
On Sat 02-03-19 12:38:58, Yafang Shao wrote: > Only mm_compaction_isolate_{free, migrate}pages may be used when > CONFIG_COMPACTION is not set. > All others are used only when CONFIG_COMPACTION is set. Why is this an improvement? > Signed-off-by: Yafang Shao <laoar.shao@gmail.com> > --- > include/trace/events/compaction.h | 6 ++---- > 1 file changed, 2 insertions(+), 4 deletions(-) > > diff --git a/include/trace/events/compaction.h b/include/trace/events/compaction.h > index 6074eff..3e42078 100644 > --- a/include/trace/events/compaction.h > +++ b/include/trace/events/compaction.h > @@ -64,6 +64,7 @@ > TP_ARGS(start_pfn, end_pfn, nr_scanned, nr_taken) > ); > > +#ifdef CONFIG_COMPACTION > TRACE_EVENT(mm_compaction_migratepages, > > TP_PROTO(unsigned long nr_all, > @@ -132,7 +133,6 @@ > __entry->sync ? "sync" : "async") > ); > > -#ifdef CONFIG_COMPACTION > TRACE_EVENT(mm_compaction_end, > TP_PROTO(unsigned long zone_start, unsigned long migrate_pfn, > unsigned long free_pfn, unsigned long zone_end, bool sync, > @@ -166,7 +166,6 @@ > __entry->sync ? "sync" : "async", > __print_symbolic(__entry->status, COMPACTION_STATUS)) > ); > -#endif > > TRACE_EVENT(mm_compaction_try_to_compact_pages, > > @@ -195,7 +194,6 @@ > __entry->prio) > ); > > -#ifdef CONFIG_COMPACTION > DECLARE_EVENT_CLASS(mm_compaction_suitable_template, > > TP_PROTO(struct zone *zone, > @@ -296,7 +294,6 @@ > > TP_ARGS(zone, order) > ); > -#endif > > TRACE_EVENT(mm_compaction_kcompactd_sleep, > > @@ -352,6 +349,7 @@ > > TP_ARGS(nid, order, classzone_idx) > ); > +#endif > > #endif /* _TRACE_COMPACTION_H */ > > -- > 1.8.3.1 >
On Wed, Mar 13, 2019 at 12:18 AM Michal Hocko <mhocko@kernel.org> wrote: > > On Sat 02-03-19 12:38:58, Yafang Shao wrote: > > Only mm_compaction_isolate_{free, migrate}pages may be used when > > CONFIG_COMPACTION is not set. > > All others are used only when CONFIG_COMPACTION is set. > > Why is this an improvement? > After this change, if CONFIG_COMPACTION is not set, the tracepoints that only work when CONFIG_COMPACTION is set will not be exposed to the usespace. Without this change, they will always be expose in debugfs no matter CONFIG_COMPACTION is set or not. That's an improvement. > > Signed-off-by: Yafang Shao <laoar.shao@gmail.com> > > --- > > include/trace/events/compaction.h | 6 ++---- > > 1 file changed, 2 insertions(+), 4 deletions(-) > > > > diff --git a/include/trace/events/compaction.h b/include/trace/events/compaction.h > > index 6074eff..3e42078 100644 > > --- a/include/trace/events/compaction.h > > +++ b/include/trace/events/compaction.h > > @@ -64,6 +64,7 @@ > > TP_ARGS(start_pfn, end_pfn, nr_scanned, nr_taken) > > ); > > > > +#ifdef CONFIG_COMPACTION > > TRACE_EVENT(mm_compaction_migratepages, > > > > TP_PROTO(unsigned long nr_all, > > @@ -132,7 +133,6 @@ > > __entry->sync ? "sync" : "async") > > ); > > > > -#ifdef CONFIG_COMPACTION > > TRACE_EVENT(mm_compaction_end, > > TP_PROTO(unsigned long zone_start, unsigned long migrate_pfn, > > unsigned long free_pfn, unsigned long zone_end, bool sync, > > @@ -166,7 +166,6 @@ > > __entry->sync ? "sync" : "async", > > __print_symbolic(__entry->status, COMPACTION_STATUS)) > > ); > > -#endif > > > > TRACE_EVENT(mm_compaction_try_to_compact_pages, > > > > @@ -195,7 +194,6 @@ > > __entry->prio) > > ); > > > > -#ifdef CONFIG_COMPACTION > > DECLARE_EVENT_CLASS(mm_compaction_suitable_template, > > > > TP_PROTO(struct zone *zone, > > @@ -296,7 +294,6 @@ > > > > TP_ARGS(zone, order) > > ); > > -#endif > > > > TRACE_EVENT(mm_compaction_kcompactd_sleep, > > > > @@ -352,6 +349,7 @@ > > > > TP_ARGS(nid, order, classzone_idx) > > ); > > +#endif > > > > #endif /* _TRACE_COMPACTION_H */ > > > > -- > > 1.8.3.1 > > > > -- > Michal Hocko > SUSE Labs
On Wed 13-03-19 00:29:57, Yafang Shao wrote: > On Wed, Mar 13, 2019 at 12:18 AM Michal Hocko <mhocko@kernel.org> wrote: > > > > On Sat 02-03-19 12:38:58, Yafang Shao wrote: > > > Only mm_compaction_isolate_{free, migrate}pages may be used when > > > CONFIG_COMPACTION is not set. > > > All others are used only when CONFIG_COMPACTION is set. > > > > Why is this an improvement? > > > > After this change, if CONFIG_COMPACTION is not set, the tracepoints > that only work when CONFIG_COMPACTION is set will not be exposed to > the usespace. > Without this change, they will always be expose in debugfs no matter > CONFIG_COMPACTION is set or not. And this is exactly something that the changelog should mention. I wasn't aware that we do export tracepoints even when they are not used by any code path. This whole macro based programming is just a black magic.
On Wed, Mar 13, 2019 at 12:44 AM Michal Hocko <mhocko@kernel.org> wrote: > > On Wed 13-03-19 00:29:57, Yafang Shao wrote: > > On Wed, Mar 13, 2019 at 12:18 AM Michal Hocko <mhocko@kernel.org> wrote: > > > > > > On Sat 02-03-19 12:38:58, Yafang Shao wrote: > > > > Only mm_compaction_isolate_{free, migrate}pages may be used when > > > > CONFIG_COMPACTION is not set. > > > > All others are used only when CONFIG_COMPACTION is set. > > > > > > Why is this an improvement? > > > > > > > After this change, if CONFIG_COMPACTION is not set, the tracepoints > > that only work when CONFIG_COMPACTION is set will not be exposed to > > the usespace. > > Without this change, they will always be expose in debugfs no matter > > CONFIG_COMPACTION is set or not. > > And this is exactly something that the changelog should mention. I > wasn't aware that we do export tracepoints even when they are not used > by any code path. This whole macro based programming is just a black > magic. > -- Sure, I will modify the changelog and send v2. Thanks Yafang
diff --git a/include/trace/events/compaction.h b/include/trace/events/compaction.h index 6074eff..3e42078 100644 --- a/include/trace/events/compaction.h +++ b/include/trace/events/compaction.h @@ -64,6 +64,7 @@ TP_ARGS(start_pfn, end_pfn, nr_scanned, nr_taken) ); +#ifdef CONFIG_COMPACTION TRACE_EVENT(mm_compaction_migratepages, TP_PROTO(unsigned long nr_all, @@ -132,7 +133,6 @@ __entry->sync ? "sync" : "async") ); -#ifdef CONFIG_COMPACTION TRACE_EVENT(mm_compaction_end, TP_PROTO(unsigned long zone_start, unsigned long migrate_pfn, unsigned long free_pfn, unsigned long zone_end, bool sync, @@ -166,7 +166,6 @@ __entry->sync ? "sync" : "async", __print_symbolic(__entry->status, COMPACTION_STATUS)) ); -#endif TRACE_EVENT(mm_compaction_try_to_compact_pages, @@ -195,7 +194,6 @@ __entry->prio) ); -#ifdef CONFIG_COMPACTION DECLARE_EVENT_CLASS(mm_compaction_suitable_template, TP_PROTO(struct zone *zone, @@ -296,7 +294,6 @@ TP_ARGS(zone, order) ); -#endif TRACE_EVENT(mm_compaction_kcompactd_sleep, @@ -352,6 +349,7 @@ TP_ARGS(nid, order, classzone_idx) ); +#endif #endif /* _TRACE_COMPACTION_H */
Only mm_compaction_isolate_{free, migrate}pages may be used when CONFIG_COMPACTION is not set. All others are used only when CONFIG_COMPACTION is set. Signed-off-by: Yafang Shao <laoar.shao@gmail.com> --- include/trace/events/compaction.h | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)