lkml.org 
[lkml]   [2022]   [Apr]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH v3 3/6] mm/slub: use stackdepot to save stack trace in objects
From
On 4/5/22 23:40, David Rientjes wrote:
>> -static void set_track(struct kmem_cache *s, void *object,
>> +static void noinline set_track(struct kmem_cache *s, void *object,
>> enum track_item alloc, unsigned long addr)
>> {
>> struct track *p = get_track(s, object, alloc);
>>
>> -#ifdef CONFIG_STACKTRACE
>> +#ifdef CONFIG_STACKDEPOT
>> + unsigned long entries[TRACK_ADDRS_COUNT];
>> unsigned int nr_entries;
>>
>> - metadata_access_enable();
>> - nr_entries = stack_trace_save(kasan_reset_tag(p->addrs),
>> - TRACK_ADDRS_COUNT, 3);
>> - metadata_access_disable();
>> -
>> - if (nr_entries < TRACK_ADDRS_COUNT)
>> - p->addrs[nr_entries] = 0;
>> + nr_entries = stack_trace_save(entries, ARRAY_SIZE(entries), 3);
>> + p->handle = stack_depot_save(entries, nr_entries, GFP_NOWAIT);
>
> I think this should also have __GFP_NOWARN set since this allocation could
> easily fail and it would unnecessarily spam the kernel log unless we
> actually care about the stack trace being printed later (and the patch
> already indicates the allocation failed in print_track() when it matters).

Good point. But turns out __stack_depot_save() adds it for us already.

> Otherwise:
>
> Acked-by: David Rientjes <rientjes@google.com>

Thanks!

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