Re: [PATCH v3 4/6] mm/slub: distinguish and print stack traces in debugfs files

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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?




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux