linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Hyeonggon Yoo <42.hyeyoo@gmail.com>
To: Feng Tang <feng.tang@intel.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	Christoph Lameter <cl@linux.com>,
	 Pekka Enberg <penberg@kernel.org>,
	David Rientjes <rientjes@google.com>,
	 Joonsoo Kim <iamjoonsoo.kim@lge.com>,
	Vlastimil Babka <vbabka@suse.cz>,
	 Roman Gushchin <roman.gushchin@linux.dev>,
	 Linux Memory Management List <linux-mm@kvack.org>,
	LKML <linux-kernel@vger.kernel.org>,
	 Dave Hansen <dave.hansen@intel.com>
Subject: Re: [RFC PATCH] mm/slub: enable debugging memory wasting of kmalloc
Date: Thu, 30 Jun 2022 23:55:59 +0900	[thread overview]
Message-ID: <CAB=+i9RhuAi-w3XbXO5236WFeg04A6ra_xG9o_-DkMaRBFMKGw@mail.gmail.com> (raw)
In-Reply-To: <Yr21Ymj5uZfFearE@hyeyoo>

On Thu, Jun 30, 2022 at 11:38 PM Hyeonggon Yoo <42.hyeyoo@gmail.com> wrote:
[...]
> > @@ -5138,11 +5146,12 @@ static int add_location(struct loc_track *t, struct kmem_cache *s,
> >               if (pos == end)
> >                       break;
> >
> > -             caddr = t->loc[pos].addr;
> > -             chandle = t->loc[pos].handle;
> > -             if ((track->addr == caddr) && (handle == chandle)) {
> > +             l = &t->loc[pos];
> > +             caddr = l->addr;
> > +             chandle = l->handle;
> > +             if ((track->addr == caddr) && (handle == chandle) &&
> > +                     (track->waste == l->waste)) {
> >
> > -                     l = &t->loc[pos];
> >                       l->count++;
> >                       if (track->when) {
> >                               l->sum_time += age;
> > @@ -5190,6 +5199,7 @@ static int add_location(struct loc_track *t, struct kmem_cache *s,
> >       l->min_pid = track->pid;
> >       l->max_pid = track->pid;
> >       l->handle = handle;
> > +     l->waste = track->waste;
>
> I think this may be fooled when there are different wastes values
> from same caller (i.e. when a kmalloc_track_caller() is used.)
> because the array is sorted by caller address, but not sorted by waste.
>
> And writing this I noticed that it already can be fooled now :)
> It's also not sorted by handle.

I misread the code. it's not fooled now. the array is also sorted by handle.
But will be fooled after this patch.

> --
> Thanks,
> Hyeonggon


  reply	other threads:[~2022-06-30 14:56 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-30  1:47 Feng Tang
2022-06-30  2:30 ` Andrew Morton
2022-06-30  2:38   ` Feng Tang
2022-06-30  2:47     ` Andrew Morton
2022-06-30  3:23       ` Feng Tang
2022-06-30  8:52       ` Robin Murphy
2022-06-30 14:38 ` Hyeonggon Yoo
2022-06-30 14:55   ` Hyeonggon Yoo [this message]
2022-07-01  2:23   ` Feng Tang
2022-07-01  9:29     ` Hyeonggon Yoo
2022-07-01 11:13       ` Feng Tang

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='CAB=+i9RhuAi-w3XbXO5236WFeg04A6ra_xG9o_-DkMaRBFMKGw@mail.gmail.com' \
    --to=42.hyeyoo@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=cl@linux.com \
    --cc=dave.hansen@intel.com \
    --cc=feng.tang@intel.com \
    --cc=iamjoonsoo.kim@lge.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=penberg@kernel.org \
    --cc=rientjes@google.com \
    --cc=roman.gushchin@linux.dev \
    --cc=vbabka@suse.cz \
    /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