lkml.org 
[lkml]   [2021]   [Oct]   [31]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] mm, slub: place the trace before freeing memory in kmem_cache_free()
On Sat, Oct 30, 2021 at 08:23:12PM +0800, Muchun Song wrote:
> On Sat, Oct 30, 2021 at 6:12 PM Yunfeng Ye <yeyunfeng@huawei.com> wrote:
> >
> > After the memory is freed, it may be allocated by other CPUs and has
> > been recorded by trace. So the timing sequence of the memory tracing is
> > inaccurate.
> >
> > For example, we expect the following timing sequeuce:
> >
> > CPU 0 CPU 1
> >
> > (1) alloc xxxxxx
> > (2) free xxxxxx
> > (3) alloc xxxxxx
> > (4) free xxxxxx
> >
> > However, the following timing sequence may occur:
> >
> > CPU 0 CPU 1
> >
> > (1) alloc xxxxxx
> > (2) alloc xxxxxx
> > (3) free xxxxxx
> > (4) free xxxxxx
> >
> > So place the trace before freeing memory in kmem_cache_free().
>
> Could you tell me what problem you have encountered
> here?

It's confusing to see the memory allocated before it's freed. If you're
unaware of this problem, you might think it was being used after free
because (1) happened a long time ago, so you see (2) immediately followed
by (3) and then see the memory being used.

The patch makes sense to me.

\
 
 \ /
  Last update: 2021-10-31 13:57    [W:0.062 / U:0.012 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site