linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Vlastimil Babka <vbabka@suse.cz>
To: Kuan-Wei Chiu <visitorckw@gmail.com>, akpm@linux-foundation.org
Cc: cl@gentwo.org, rientjes@google.com, roman.gushchin@linux.dev,
	harry.yoo@oracle.com, glittao@gmail.com, jserv@ccns.ncku.edu.tw,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/2] mm/slub: Replace sort_r() with sort() for debugfs stack trace sorting
Date: Mon, 25 Aug 2025 19:31:41 +0200	[thread overview]
Message-ID: <7cfb3108-342b-41b7-b4fe-b01a574dbdf0@suse.cz> (raw)
In-Reply-To: <20250825013419.240278-3-visitorckw@gmail.com>

On 8/25/25 03:34, Kuan-Wei Chiu wrote:
> The comparison function used to sort stack trace locations in debugfs
> never relied on the third argument. Therefore, sort_r() is unnecessary.
> Switch to sort() with a two-argument comparison function to keep the
> code simple and aligned with the intended usage.
> 
> Signed-off-by: Kuan-Wei Chiu <visitorckw@gmail.com>

LGTM.

> ---
>  mm/slub.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/mm/slub.c b/mm/slub.c
> index c91b3744adbc..67b68f132f84 100644
> --- a/mm/slub.c
> +++ b/mm/slub.c
> @@ -7711,7 +7711,7 @@ 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)
> +static int cmp_loc_by_count(const void *a, const void *b)
>  {
>  	struct location *loc1 = (struct location *)a;
>  	struct location *loc2 = (struct location *)b;
> @@ -7782,8 +7782,8 @@ static int slab_debug_trace_open(struct inode *inode, struct file *filep)
>  	}
>  
>  	/* Sort locations by count */
> -	sort_r(t->loc, t->count, sizeof(struct location),
> -		cmp_loc_by_count, NULL, NULL);
> +	sort(t->loc, t->count, sizeof(struct location),
> +	     cmp_loc_by_count, NULL);
>  
>  	bitmap_free(obj_map);
>  	return 0;



      reply	other threads:[~2025-08-25 17:31 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-25  1:34 [PATCH 0/2] mm/slub: Fix debugfs stack trace sorting and simplify sort call Kuan-Wei Chiu
2025-08-25  1:34 ` [PATCH 1/2] mm/slub: Fix cmp_loc_by_count() to return 0 when counts are equal Kuan-Wei Chiu
2025-08-25 14:48   ` Joshua Hahn
2025-08-25 16:18     ` Kuan-Wei Chiu
2025-08-25 17:12       ` Joshua Hahn
2025-08-25 17:28   ` Vlastimil Babka
2025-08-25 17:54     ` Kuan-Wei Chiu
2025-08-26  7:53       ` Harry Yoo
2025-08-28 17:13         ` Kuan-Wei Chiu
2025-08-29  2:06           ` Harry Yoo
2025-08-25  1:34 ` [PATCH 2/2] mm/slub: Replace sort_r() with sort() for debugfs stack trace sorting Kuan-Wei Chiu
2025-08-25 17:31   ` Vlastimil Babka [this message]

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=7cfb3108-342b-41b7-b4fe-b01a574dbdf0@suse.cz \
    --to=vbabka@suse.cz \
    --cc=akpm@linux-foundation.org \
    --cc=cl@gentwo.org \
    --cc=glittao@gmail.com \
    --cc=harry.yoo@oracle.com \
    --cc=jserv@ccns.ncku.edu.tw \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=rientjes@google.com \
    --cc=roman.gushchin@linux.dev \
    --cc=visitorckw@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