From: Marco Elver <elver@google.com>
To: chenqiwu <qiwuchen55@gmail.com>
Cc: glider@google.com, dvyukov@google.com, akpm@linux-foundation.org,
kasan-dev@googlegroups.com, linux-mm@kvack.org
Subject: Re: [PATCH] mm: kfence: print the age time for alloacted objectes to trace memleak
Date: Sun, 4 Aug 2024 10:37:43 +0200 [thread overview]
Message-ID: <CANpmjNPN7yeD-x_m+nt_bsL0Cczg4RnoRWGxPKqg-N5GdmBjZA@mail.gmail.com> (raw)
In-Reply-To: <20240804034607.GA11291@rlk>
On Sun, 4 Aug 2024 at 05:46, chenqiwu <qiwuchen55@gmail.com> wrote:
[...]
> > I've found myself trying to figure out the elapsed time since the
> > allocation or free, based on the current timestamp.
> >
> > So something that would be more helpful is if you just change the
> > printed line for all alloc and free stack infos to say something like:
> >
> > seq_con_printf(seq, "%s by task %d on cpu %d at %lu.%06lus (%lu.%06lus ago):\n",
> >
> > So rather than saying this info is the "age", we just say the elapsed
> > time. That generalizes this bit of info, and it'll be available for
> > both alloc and free stacks.
> >
> > Does that work for you?
> >
> It does not work for me actually, since it's unintuitive to figure out memory leaks
The number printed is the same. It's just the change of "age" to "ago".
> by the elapsed time of allocated stacks when inspect /sys/kernel/debug/kfence/objects.
> It's unnecessary to print the elapsed time of allocated stacks for the objects in KFENCE_OBJECT_FREED
> state. For the elapsed time of free stacks, it seems no available scenarion currently.
> BTW, The change from "age" to "ago" is okay to me!
Well, what I'm saying, having this info also for FREED objects on the
free stack can be useful in some debugging scenarios when you get a
use-after-free, and you want to know the elapsed time since the free
happened. I have done this calculation manually before, which is why I
suggested it. Maybe it's not useful for you for finding leaks, but
that's just one usecase.
Thanks,
-- Marco
next prev parent reply other threads:[~2024-08-04 8:38 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-03 13:36 Qiwu Chen
2024-08-03 14:51 ` Marco Elver
2024-08-04 3:46 ` chenqiwu
2024-08-04 8:37 ` Marco Elver [this message]
2024-08-05 3:35 ` chenqiwu
2024-08-05 6:50 ` Marco Elver
2024-08-05 14:06 ` chenqiwu
2024-08-05 14:18 ` Marco Elver
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CANpmjNPN7yeD-x_m+nt_bsL0Cczg4RnoRWGxPKqg-N5GdmBjZA@mail.gmail.com \
--to=elver@google.com \
--cc=akpm@linux-foundation.org \
--cc=dvyukov@google.com \
--cc=glider@google.com \
--cc=kasan-dev@googlegroups.com \
--cc=linux-mm@kvack.org \
--cc=qiwuchen55@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox