lkml.org 
[lkml]   [2022]   [Apr]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH v3 4/6] mm/slub: distinguish and print stack traces in debugfs files
From
On 4/5/22 23:40, David Rientjes wrote:
>> @@ -5116,9 +5117,13 @@ static int add_location(struct loc_track *t, struct kmem_cache *s,
>> {
>> long start, end, pos;
>> struct location *l;
>> - unsigned long caddr;
>> + unsigned long caddr, chandle;
>> unsigned long age = jiffies - track->when;
>> + depot_stack_handle_t handle = 0;
>>
>> +#ifdef CONFIG_STACKDEPOT
>> + handle = READ_ONCE(track->handle);
>> +#endif
>> start = -1;
>> end = t->count;
>>
>> @@ -5133,7 +5138,8 @@ static int add_location(struct loc_track *t, struct kmem_cache *s,
>> break;
>>
>> caddr = t->loc[pos].addr;
>> - if (track->addr == caddr) {
>> + chandle = t->loc[pos].handle;
>> + if ((track->addr == caddr) && (handle == chandle)) {
>>
>> l = &t->loc[pos];
>> l->count++;
>> @@ -5158,6 +5164,8 @@ static int add_location(struct loc_track *t, struct kmem_cache *s,
>>
>> if (track->addr < caddr)
>> end = pos;
>> + else if (track->addr == caddr && handle < chandle)
>> + end = pos;
>> else
>> start = pos;
>> }
>
> Does this need to properly handle the case where handle == NULL?

Hm I can't think of how much more properly is possible. If objects have same
track->addr (which is the immediate caller) and also same NULL handle, they
will be counted together. I think it's the best we can do?

\
 
 \ /
  Last update: 2022-04-06 16:00    [W:0.496 / U:0.008 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site