On Thu, Jun 30, 2022 at 11:38 PM Hyeonggon Yoo <42.hyeyoo@xxxxxxxxx> wrote: [...] > > @@ -5138,11 +5146,12 @@ static int add_location(struct loc_track *t, struct kmem_cache *s, > > if (pos == end) > > break; > > > > - caddr = t->loc[pos].addr; > > - chandle = t->loc[pos].handle; > > - if ((track->addr == caddr) && (handle == chandle)) { > > + l = &t->loc[pos]; > > + caddr = l->addr; > > + chandle = l->handle; > > + if ((track->addr == caddr) && (handle == chandle) && > > + (track->waste == l->waste)) { > > > > - l = &t->loc[pos]; > > l->count++; > > if (track->when) { > > l->sum_time += age; > > @@ -5190,6 +5199,7 @@ static int add_location(struct loc_track *t, struct kmem_cache *s, > > l->min_pid = track->pid; > > l->max_pid = track->pid; > > l->handle = handle; > > + l->waste = track->waste; > > I think this may be fooled when there are different wastes values > from same caller (i.e. when a kmalloc_track_caller() is used.) > because the array is sorted by caller address, but not sorted by waste. > > And writing this I noticed that it already can be fooled now :) > It's also not sorted by handle. I misread the code. it's not fooled now. the array is also sorted by handle. But will be fooled after this patch. > -- > Thanks, > Hyeonggon