]> www.infradead.org Git - users/hch/misc.git/commitdiff
mm/slub: Replace sort_r() with sort() for debugfs stack trace sorting
authorKuan-Wei Chiu <visitorckw@gmail.com>
Tue, 26 Aug 2025 06:23:15 +0000 (14:23 +0800)
committerVlastimil Babka <vbabka@suse.cz>
Wed, 10 Sep 2025 20:52:33 +0000 (22:52 +0200)
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>
Reviewed-by: Harry Yoo <harry.yoo@oracle.com>
Signed-off-by: Vlastimil Babka <vbabka@suse.cz>
mm/slub.c

index 264fc76455d7395c2e469c72c269a1d0ec222982..9074ce914e9e1ceafe733e3ab0bac413993e7b71 100644 (file)
--- a/mm/slub.c
+++ b/mm/slub.c
@@ -7726,7 +7726,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;
@@ -7793,8 +7793,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;