From: Vlastimil Babka <vbabka@suse.cz>
To: glittao@gmail.com, cl@linux.com, penberg@kernel.org,
rientjes@google.com, iamjoonsoo.kim@lge.com,
akpm@linux-foundation.org
Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, faiyazm@codeaurora.org
Subject: Re: [RFC 2/3] mm/slub: sort objects in cache by frequency of stack trace
Date: Wed, 26 May 2021 16:06:39 +0200 [thread overview]
Message-ID: <c9b88ab1-42dc-1198-4ad1-e9a980d4a6bf@suse.cz> (raw)
In-Reply-To: <20210521121127.24653-2-glittao@gmail.com>
On 5/21/21 2:11 PM, glittao@gmail.com wrote:
> From: Oliver Glitta <glittao@gmail.com>
>
> Sort objects in slub cache by the frequency of stack trace used
> in object location in alloc_calls and free_calls implementation
> in debugfs. Most frequently used stack traces will be the first.
That will make it much more convenient.
> Signed-off-by: Oliver Glitta <glittao@gmail.com>
Reviewed-by: Vlastimil Babka <vbabka@suse.cz>
> ---
> mm/slub.c | 17 +++++++++++++++++
> 1 file changed, 17 insertions(+)
>
> diff --git a/mm/slub.c b/mm/slub.c
> index d5ed6ed7d68b..247983d647cd 100644
> --- a/mm/slub.c
> +++ b/mm/slub.c
> @@ -37,6 +37,7 @@
> #include <linux/memcontrol.h>
> #include <linux/random.h>
> #include <kunit/test.h>
> +#include <linux/sort.h>
>
> #include <linux/debugfs.h>
> #include <trace/events/kmem.h>
> @@ -5893,6 +5894,17 @@ static void *slab_debugfs_next(struct seq_file *seq, void *v, loff_t *ppos)
> return NULL;
> }
>
> +static int cmp_loc_by_count(const void *a, const void *b, const void *data)
> +{
> + struct location *loc1 = (struct location *)a;
> + struct location *loc2 = (struct location *)b;
> +
> + if (loc1->count > loc2->count)
> + return -1;
> + else
> + return 1;
> +}
> +
> static void *slab_debugfs_start(struct seq_file *seq, loff_t *ppos)
> {
> struct kmem_cache_node *n;
> @@ -5944,6 +5956,11 @@ static void *slab_debugfs_start(struct seq_file *seq, loff_t *ppos)
> process_slab(&t, s, page, alloc);
> spin_unlock_irqrestore(&n->list_lock, flags);
> }
> +
> + /* Sort locations by count */
> + sort_r(t.loc, t.count, sizeof(struct location),
> + cmp_loc_by_count, NULL, NULL);
> +
> }
>
> if (*ppos < t.count) {
>
next prev parent reply other threads:[~2021-05-26 14:06 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-05-21 12:11 [RFC 1/3] mm/slub: aggregate objects in cache by " glittao
2021-05-21 12:11 ` [RFC 2/3] mm/slub: sort objects in cache by frequency of " glittao
2021-05-26 14:06 ` Vlastimil Babka [this message]
2021-05-21 12:11 ` [RFC 3/3] mm/slub: add all_objects implementation in debugfs glittao
2021-05-26 14:26 ` Vlastimil Babka
2021-05-26 14:05 ` [RFC 1/3] mm/slub: aggregate objects in cache by stack trace Vlastimil Babka
2021-06-08 8:45 ` [RFC 4/4] docs: add description of debugfs files for SLUB cache glittao
2021-06-14 0:08 ` David Rientjes
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=c9b88ab1-42dc-1198-4ad1-e9a980d4a6bf@suse.cz \
--to=vbabka@suse.cz \
--cc=akpm@linux-foundation.org \
--cc=cl@linux.com \
--cc=faiyazm@codeaurora.org \
--cc=glittao@gmail.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 \
/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