Message ID | df8d52f1fb2f353a62ff34dc09fe99e32ca1f63f.1636546262.git.xhao@linux.alibaba.com (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | mm/damon: Do some small changes | expand |
On Wed, 10 Nov 2021 20:13:14 +0800 Xin Hao <xhao@linux.alibaba.com> wrote: > In patch "mm/damon: add a tracepoint", it adds a > tracepoint for DAMON, it can monitor each region > for each aggregation interval, Now the region add > a new 'age' variable, some primitive would calculate > the priority of each region as a weight, there put it > into tracepoint, so we can easily track the change of > its value through perf or damon-tools. DAMON calculates the age using the address range and nr_accesses of the region, which are already in the tracepoint. In other words, user space can calculate the age on their own. Therefore I thought putting age in the tracepoint as adding unnecessary information, at the moment of the implementation. Of course, I would missing some use cases that need this information in the tracepoint. Furthermore, adding just one more value in the tracepoint wouldn't incur a real issue. But, I'd like to know why this is necessary and how much benefit it provides. Xin, could you please share that? Thanks, SJ > > Signed-off-by: Xin Hao <xhao@linux.alibaba.com> > --- > include/trace/events/damon.h | 7 +++++-- > 1 file changed, 5 insertions(+), 2 deletions(-) > > diff --git a/include/trace/events/damon.h b/include/trace/events/damon.h > index 2f422f4f1fb9..99ffa601e351 100644 > --- a/include/trace/events/damon.h > +++ b/include/trace/events/damon.h > @@ -22,6 +22,7 @@ TRACE_EVENT(damon_aggregated, > __field(unsigned long, start) > __field(unsigned long, end) > __field(unsigned int, nr_accesses) > + __field(unsigned int, age) > ), > > TP_fast_assign( > @@ -30,11 +31,13 @@ TRACE_EVENT(damon_aggregated, > __entry->start = r->ar.start; > __entry->end = r->ar.end; > __entry->nr_accesses = r->nr_accesses; > + __entry->age = r->age; > ), > > - TP_printk("target_id=%lu nr_regions=%u %lu-%lu: %u", > + TP_printk("target_id=%lu nr_regions=%u %lu-%lu: %u %u", > __entry->target_id, __entry->nr_regions, > - __entry->start, __entry->end, __entry->nr_accesses) > + __entry->start, __entry->end, > + __entry->nr_accesses, __entry->age) > ); > > #endif /* _TRACE_DAMON_H */ > -- > 2.31.0
Hi Park: On 2021/11/10 下午9:16, SeongJae Park wrote: > On Wed, 10 Nov 2021 20:13:14 +0800 Xin Hao <xhao@linux.alibaba.com> wrote: > >> In patch "mm/damon: add a tracepoint", it adds a >> tracepoint for DAMON, it can monitor each region >> for each aggregation interval, Now the region add >> a new 'age' variable, some primitive would calculate >> the priority of each region as a weight, there put it >> into tracepoint, so we can easily track the change of >> its value through perf or damon-tools. > DAMON calculates the age using the address range and nr_accesses of the region, > which are already in the tracepoint. In other words, user space can calculate > the age on their own. Therefore I thought putting age in the tracepoint as > adding unnecessary information, at the moment of the implementation. > > Of course, I would missing some use cases that need this information in the > tracepoint. Furthermore, adding just one more value in the tracepoint wouldn't > incur a real issue. But, I'd like to know why this is necessary and how much > benefit it provides. Xin, could you please share that? I think these two variables nr_access & age have different meanings, the nr_access only reflect the period of sample_interval, We may be able to get the change of age through continuous long-term sampling, But I think this is not very convenient. We only need to observe the change of age value a small number of times to replace the continue sampling of the region. For example, age has been increasing to 141, but nr_access shows a value of 0 at a certain time. Through this,we can conclude that the region has a very low nr_access value for a long time. This datas that i used perf tool to record & script * kdamond.0 8282 [007] 664.187237: damon:damon_aggregated: target_id=18446462650354140800 nr_regions=16 305254400-597266432: 0 140** ** kdamond.0 8282 [007] 664.187237: damon:damon_aggregated: target_id=18446462650354140800 nr_regions=16 597266432-900239360: 0 140** ** kdamond.0 8282 [007] 664.187237: damon:damon_aggregated: target_id=18446462650354140800 nr_regions=16 900239360-980148224: 0 140* kdamond.0 8282 [007] 664.187238: damon:damon_aggregated: target_id=18446462650354140800 nr_regions=16 281471544459264-281471789129728: 0 1 kdamond.0 8282 [007] 664.187238: damon:damon_aggregated: target_id=18446462650354140800 nr_regions=16 281471789129728-281472066732032: 0 0 kdamond.0 8282 [007] 664.187238: damon:damon_aggregated: target_id=18446462650354140800 nr_regions=16 281472066732032-281472281972736: 0 1 kdamond.0 8282 [007] 664.187239: damon:damon_aggregated: target_id=18446462650354140800 nr_regions=16 281472281972736-281472346124288: 1 0 kdamond.0 8282 [007] 664.187239: damon:damon_aggregated: target_id=18446462650354140800 nr_regions=16 281472346124288-281472379187200: 0 1 kdamond.0 8282 [007] 664.187239: damon:damon_aggregated: target_id=18446462650354140800 nr_regions=16 281472379187200-281472678154240: 1 0 kdamond.0 8282 [007] 664.187239: damon:damon_aggregated: target_id=18446462650354140800 nr_regions=16 281472678154240-281472951209984: 1 0 kdamond.0 8282 [007] 664.187240: damon:damon_aggregated: target_id=18446462650354140800 nr_regions=16 281472951209984-281473069228032: 2 0 kdamond.0 8282 [007] 664.187240: damon:damon_aggregated: target_id=18446462650354140800 nr_regions=16 281473069228032-281473299972096: 0 1 kdamond.0 8282 [007] 664.187241: damon:damon_aggregated: target_id=18446462650354140800 nr_regions=16 281473299972096-281473603727360: 0 0 kdamond.0 8282 [007] 664.187241: damon:damon_aggregated: target_id=18446462650354140800 nr_regions=16 281473603727360-281473611063296: 0 5 kdamond.0 8282 [007] 664.187242: damon:damon_aggregated: target_id=18446462650354140800 nr_regions=16 281474851557376-281474851692544: 0 140 * kdamond.0 8282 [007] 664.287642: damon:damon_aggregated: target_id=18446462650354140800 nr_regions=16 4194304-305254400: 0 141* * kdamond.0 8282 [007] 664.287643: damon:damon_aggregated: target_id=18446462650354140800 nr_regions=16 305254400-597266432: 0 141* * kdamond.0 8282 [007] 664.287643: damon:damon_aggregated: target_id=18446462650354140800 nr_regions=16 597266432-900239360: 0 141* * kdamond.0 8282 [007] 664.287650: damon:damon_aggregated: target_id=18446462650354140800 nr_regions=16 900239360-980148224: 0 141* kdamond.0 8282 [007] 664.287650: damon:damon_aggregated: target_id=18446462650354140800 nr_regions=16 281471544459264-281471789129728: 0 2 kdamond.0 8282 [007] 664.287651: damon:damon_aggregated: target_id=18446462650354140800 nr_regions=16 281471789129728-281472066732032: 0 1 kdamond.0 8282 [007] 664.287651: damon:damon_aggregated: target_id=18446462650354140800 nr_regions=16 281472066732032-281472349429760: 0 0 kdamond.0 8282 [007] 664.287651: damon:damon_aggregated: target_id=18446462650354140800 nr_regions=16 281472349429760-281472588464128: 0 0 kdamond.0 8282 [007] 664.287652: damon:damon_aggregated: target_id=18446462650354140800 nr_regions=16 281472588464128-281472678154240: 0 0 kdamond.0 8282 [007] 664.287652: damon:damon_aggregated: target_id=18446462650354140800 nr_regions=16 281472678154240-281472951209984: 0 0 kdamond.0 8282 [007] 664.287652: damon:damon_aggregated: target_id=18446462650354140800 nr_regions=16 281472951209984-281473092300800: 1 0 kdamond.0 8282 [007] 664.287653: damon:damon_aggregated: target_id=18446462650354140800 nr_regions=16 281473092300800-281473299972096: 0 2 kdamond.0 8282 [007] 664.287654: damon:damon_aggregated: target_id=18446462650354140800 nr_regions=16 281473299972096-281473421471744: 0 1 kdamond.0 8282 [007] 664.287654: damon:damon_aggregated: target_id=18446462650354140800 nr_regions=16 281473421471744-281473603727360: 2 0 kdamond.0 8282 [007] 664.287654: damon:damon_aggregated: target_id=18446462650354140800 nr_regions=16 281473603727360-281473611063296: 0 6 kdamond.0 8282 [007] 664.287655: damon:damon_aggregated: target_id=18446462650354140800 nr_regions=16 281474851557376-281474851692544: 0 141 > > > Thanks, > SJ > >> Signed-off-by: Xin Hao <xhao@linux.alibaba.com> >> --- >> include/trace/events/damon.h | 7 +++++-- >> 1 file changed, 5 insertions(+), 2 deletions(-) >> >> diff --git a/include/trace/events/damon.h b/include/trace/events/damon.h >> index 2f422f4f1fb9..99ffa601e351 100644 >> --- a/include/trace/events/damon.h >> +++ b/include/trace/events/damon.h >> @@ -22,6 +22,7 @@ TRACE_EVENT(damon_aggregated, >> __field(unsigned long, start) >> __field(unsigned long, end) >> __field(unsigned int, nr_accesses) >> + __field(unsigned int, age) >> ), >> >> TP_fast_assign( >> @@ -30,11 +31,13 @@ TRACE_EVENT(damon_aggregated, >> __entry->start = r->ar.start; >> __entry->end = r->ar.end; >> __entry->nr_accesses = r->nr_accesses; >> + __entry->age = r->age; >> ), >> >> - TP_printk("target_id=%lu nr_regions=%u %lu-%lu: %u", >> + TP_printk("target_id=%lu nr_regions=%u %lu-%lu: %u %u", >> __entry->target_id, __entry->nr_regions, >> - __entry->start, __entry->end, __entry->nr_accesses) >> + __entry->start, __entry->end, >> + __entry->nr_accesses, __entry->age) >> ); >> >> #endif /* _TRACE_DAMON_H */ >> -- >> 2.31.0
On Thu, 11 Nov 2021 10:04:38 +0800 Xin Hao <xhao@linux.alibaba.com> wrote: > [-- Attachment #1: Type: text/plain, Size: 8070 bytes --] > > Hi Park: > > On 2021/11/10 下午9:16, SeongJae Park wrote: > > On Wed, 10 Nov 2021 20:13:14 +0800 Xin Hao <xhao@linux.alibaba.com> wrote: > > > >> In patch "mm/damon: add a tracepoint", it adds a > >> tracepoint for DAMON, it can monitor each region > >> for each aggregation interval, Now the region add > >> a new 'age' variable, some primitive would calculate > >> the priority of each region as a weight, there put it > >> into tracepoint, so we can easily track the change of > >> its value through perf or damon-tools. > > DAMON calculates the age using the address range and nr_accesses of the region, > > which are already in the tracepoint. In other words, user space can calculate > > the age on their own. Therefore I thought putting age in the tracepoint as > > adding unnecessary information, at the moment of the implementation. > > > > Of course, I would missing some use cases that need this information in the > > tracepoint. Furthermore, adding just one more value in the tracepoint wouldn't > > incur a real issue. But, I'd like to know why this is necessary and how much > > benefit it provides. Xin, could you please share that? > > I think these two variables nr_access & age have different meanings, > the nr_access only reflect the > > period of sample_interval, We may be able to get the change of age > through continuous long-term sampling, > > But I think this is not very convenient. > > We only need to observe the change of age value a small number of times > to replace the continue sampling of the region. > > For example, age has been increasing to 141, but nr_access shows a value > of 0 at a certain time. Through this,we can > > conclude that the region has a very low nr_access value for a long time. I understand that you don't want to record all the traces and then process the huge trace data in user space in order to get the age information, because you want to save disk space and CPU cycles. Is that correct? If so, I think that makes sense, and it would be better to put that in the commit message. Thanks, SJ [...]
Hi, Park: On 2021/11/11 下午4:20, SeongJae Park wrote: > On Thu, 11 Nov 2021 10:04:38 +0800 Xin Hao <xhao@linux.alibaba.com> wrote: > >> [-- Attachment #1: Type: text/plain, Size: 8070 bytes --] >> >> Hi Park: >> >> On 2021/11/10 下午9:16, SeongJae Park wrote: >>> On Wed, 10 Nov 2021 20:13:14 +0800 Xin Hao <xhao@linux.alibaba.com> wrote: >>> >>>> In patch "mm/damon: add a tracepoint", it adds a >>>> tracepoint for DAMON, it can monitor each region >>>> for each aggregation interval, Now the region add >>>> a new 'age' variable, some primitive would calculate >>>> the priority of each region as a weight, there put it >>>> into tracepoint, so we can easily track the change of >>>> its value through perf or damon-tools. >>> DAMON calculates the age using the address range and nr_accesses of the region, >>> which are already in the tracepoint. In other words, user space can calculate >>> the age on their own. Therefore I thought putting age in the tracepoint as >>> adding unnecessary information, at the moment of the implementation. >>> >>> Of course, I would missing some use cases that need this information in the >>> tracepoint. Furthermore, adding just one more value in the tracepoint wouldn't >>> incur a real issue. But, I'd like to know why this is necessary and how much >>> benefit it provides. Xin, could you please share that? >> I think these two variables nr_access & age have different meanings, >> the nr_access only reflect the >> >> period of sample_interval, We may be able to get the change of age >> through continuous long-term sampling, >> >> But I think this is not very convenient. >> >> We only need to observe the change of age value a small number of times >> to replace the continue sampling of the region. >> >> For example, age has been increasing to 141, but nr_access shows a value >> of 0 at a certain time. Through this,we can >> >> conclude that the region has a very low nr_access value for a long time. > I understand that you don't want to record all the traces and then process the > huge trace data in user space in order to get the age information, because you > want to save disk space and CPU cycles. Is that correct? If so, I think that > makes sense, and it would be better to put that in the commit message. Yes, What you said is absolutely correct, that's how I thought about it, I will add this part of the information to the commit,thanks! > > > Thanks, > SJ > > [...]
diff --git a/include/trace/events/damon.h b/include/trace/events/damon.h index 2f422f4f1fb9..99ffa601e351 100644 --- a/include/trace/events/damon.h +++ b/include/trace/events/damon.h @@ -22,6 +22,7 @@ TRACE_EVENT(damon_aggregated, __field(unsigned long, start) __field(unsigned long, end) __field(unsigned int, nr_accesses) + __field(unsigned int, age) ), TP_fast_assign( @@ -30,11 +31,13 @@ TRACE_EVENT(damon_aggregated, __entry->start = r->ar.start; __entry->end = r->ar.end; __entry->nr_accesses = r->nr_accesses; + __entry->age = r->age; ), - TP_printk("target_id=%lu nr_regions=%u %lu-%lu: %u", + TP_printk("target_id=%lu nr_regions=%u %lu-%lu: %u %u", __entry->target_id, __entry->nr_regions, - __entry->start, __entry->end, __entry->nr_accesses) + __entry->start, __entry->end, + __entry->nr_accesses, __entry->age) ); #endif /* _TRACE_DAMON_H */
In patch "mm/damon: add a tracepoint", it adds a tracepoint for DAMON, it can monitor each region for each aggregation interval, Now the region add a new 'age' variable, some primitive would calculate the priority of each region as a weight, there put it into tracepoint, so we can easily track the change of its value through perf or damon-tools. Signed-off-by: Xin Hao <xhao@linux.alibaba.com> --- include/trace/events/damon.h | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)