summaryrefslogtreecommitdiff
path: root/rust/helpers/bitops.c
diff options
context:
space:
mode:
authorKuan-Wei Chiu <visitorckw@gmail.com>2025-08-26 14:23:14 +0800
committerVlastimil Babka <vbabka@suse.cz>2025-09-10 22:52:33 +0200
commite1c4350327b39c9cad27b6c5779b3754384f26c8 (patch)
tree056473b86b8d5c54e82ecc920f0d639202191941 /rust/helpers/bitops.c
parent850470a8413a8a78e772c4f6bd9fe81ec6bd5b0f (diff)
mm/slub: Fix cmp_loc_by_count() to return 0 when counts are equal
The comparison function cmp_loc_by_count() used for sorting stack trace locations in debugfs currently returns -1 if a->count > b->count and 1 otherwise. This breaks the antisymmetry property required by sort(), because when two counts are equal, both cmp(a, b) and cmp(b, a) return 1. This can lead to undefined or incorrect ordering results. Fix it by updating the comparison logic to explicitly handle the case when counts are equal, and use cmp_int() to ensure the comparison function adheres to the required mathematical properties of antisymmetry. Fixes: 553c0369b3e1 ("mm/slub: sort debugfs output by frequency of stack traces") Reviewed-by: Joshua Hahn <joshua.hahnjy@gmail.com> 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>
Diffstat (limited to 'rust/helpers/bitops.c')
0 files changed, 0 insertions, 0 deletions