Skip to content

Commit ba7a896

Browse files
visitorckwtehcaster
authored andcommitted
mm/slub: Replace sort_r() with sort() for debugfs stack trace sorting
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 <[email protected]> Reviewed-by: Harry Yoo <[email protected]> Signed-off-by: Vlastimil Babka <[email protected]>
1 parent e1c4350 commit ba7a896

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

mm/slub.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7726,7 +7726,7 @@ static void *slab_debugfs_next(struct seq_file *seq, void *v, loff_t *ppos)
77267726
return NULL;
77277727
}
77287728

7729-
static int cmp_loc_by_count(const void *a, const void *b, const void *data)
7729+
static int cmp_loc_by_count(const void *a, const void *b)
77307730
{
77317731
struct location *loc1 = (struct location *)a;
77327732
struct location *loc2 = (struct location *)b;
@@ -7793,8 +7793,8 @@ static int slab_debug_trace_open(struct inode *inode, struct file *filep)
77937793
}
77947794

77957795
/* Sort locations by count */
7796-
sort_r(t->loc, t->count, sizeof(struct location),
7797-
cmp_loc_by_count, NULL, NULL);
7796+
sort(t->loc, t->count, sizeof(struct location),
7797+
cmp_loc_by_count, NULL);
77987798

77997799
bitmap_free(obj_map);
78007800
return 0;

0 commit comments

Comments
 (0)