lkml.org 
[lkml]   [2021]   [Apr]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH] mm: append __GFP_COMP flag for trace_malloc
On Tue, Apr 27, 2021 at 10:54 AM Matthew Wilcox <willy@infradead.org> wrote:
>
> On Tue, Apr 27, 2021 at 10:43:20AM +0800, Xiongwei Song wrote:
> > From: Xiongwei Song <sxwjean@gmail.com>
> >
> > When calling kmalloc_order, the flags should include __GFP_COMP here,
> > so that trace_malloc can trace the precise flags.
>
> I suppose that depends on your point of view.
Correct.

Should we report the
> flags used by the caller, or the flags that we used to allocate memory?
> And why does it matter?
When I capture kmem:kmalloc events on my env with perf:
(perf record -p my_pid -e kmem:kmalloc)
I got the result below:
0.08% call_site=ffffffff851d0cb0 ptr=0xffff8c04a4ca0000
bytes_req=10176 bytes_alloc=16384
gfp_flags=GFP_ATOMIC|__GFP_NOWARN|__GFP_NOMEMALLOC
0.08% call_site=ffffffff851d0cb0 ptr=0xffff8c04a4ca4000
bytes_req=10176 bytes_alloc=16384
gfp_flags=GFP_ATOMIC|__GFP_NOWARN|__GFP_NOMEMALLOC
0.08% call_site=ffffffff851d0cb0 ptr=0xffff8c04a4ca8000
bytes_req=10176 bytes_alloc=16384
gfp_flags=GFP_ATOMIC|__GFP_NOWARN|__GFP_NOMEMALLOC
0.08% call_site=ffffffff851d0cb0 ptr=0xffff8c04a6f80000
bytes_req=10176 bytes_alloc=16384
gfp_flags=GFP_ATOMIC|__GFP_NOWARN|__GFP_NOMEMALLOC
0.08% call_site=ffffffff851d0cb0 ptr=0xffff8c04a6f84000
bytes_req=10176 bytes_alloc=16384
gfp_flags=GFP_ATOMIC|__GFP_NOWARN|__GFP_NOMEMALLOC
0.08% call_site=ffffffff851d0cb0 ptr=0xffff8c04a6f88000
bytes_req=10176 bytes_alloc=16384
gfp_flags=GFP_ATOMIC|__GFP_NOWARN|__GFP_NOMEMALLOC
0.08% call_site=ffffffff851d0cb0 ptr=0xffff8c04a6f8c000
bytes_req=10176 bytes_alloc=16384
gfp_flags=GFP_ATOMIC|__GFP_NOWARN|__GFP_NOMEMALLOC
0.07% call_site=ffffffff851d0cb0 ptr=0xffff8c04a4c80000
bytes_req=10176 bytes_alloc=16384
gfp_flags=GFP_ATOMIC|__GFP_NOWARN|__GFP_NOMEMALLOC

The value of gfp_flags made me confused, I spent some time to find out
which trace_malloc
is here. So I think we should append __GFP_COMP.

Regards

\
 
 \ /
  Last update: 2021-04-27 05:30    [W:0.077 / U:0.752 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site