Ubuntu-focal-kernel/tools
Yuanzheng Song ad861069dc tools/vm/slabinfo: use alphabetic order when two values are equal
BugLink: https://bugs.launchpad.net/bugs/1990190

commit 4f5ceb8851f0081af54313abbf56de1615911faf upstream.

When the number of partial slabs in each cache is the same (e.g., the
value are 0), the results of the `slabinfo -X -N5` and `slabinfo -P -N5`
are different.

/ # slabinfo -X -N5
...
Slabs sorted by number of partial slabs
---------------------------------------
Name                   Objects Objsize           Space Slabs/Part/Cpu  O/S O %Fr %Ef Flg
inode_cache              15180     392         6217728        758/0/1   20 1   0  95 a
kernfs_node_cache        22494      88         2002944        488/0/1   46 0   0  98
shmem_inode_cache          663     464          319488         38/0/1   17 1   0  96
biovec-max                  50    3072          163840          4/0/1   10 3   0  93 A
dentry                   19050     136         2600960        633/0/2   30 0   0  99 a

/ # slabinfo -P -N5
Name                   Objects Objsize           Space Slabs/Part/Cpu  O/S O %Fr %Ef Flg
bdev_cache                  32     984           32.7K          1/0/1   16 2   0  96 Aa
ext4_inode_cache            42     752           32.7K          1/0/1   21 2   0  96 a
dentry                   19050     136            2.6M        633/0/2   30 0   0  99 a
TCPv6                       17    1840           32.7K          0/0/1   17 3   0  95 A
RAWv6                       18     856           16.3K          0/0/1   18 2   0  94 A

This problem is caused by the sort_slabs().  So let's use alphabetic order
when two values are equal in the sort_slabs().

By the way, the content of the `slabinfo -h` is not aligned because the

`-P|--partial Sort by number of partial slabs`

uses tabs instead of spaces.  So let's use spaces instead of tabs to fix
it.

Link: https://lkml.kernel.org/r/20220528063117.935158-1-songyuanzheng@huawei.com
Fixes: 1106b205a3 ("tools/vm/slabinfo: add partial slab listing to -X")
Signed-off-by: Yuanzheng Song <songyuanzheng@huawei.com>
Cc: "Tobin C. Harding" <tobin@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
2022-10-17 15:01:45 +02:00
..
accounting
arch x86/speculation: Add RSB VM Exit protections 2022-09-16 11:00:23 +02:00
bpf bpftool: Remove inclusion of utilities.mak from Makefiles 2022-03-07 16:36:52 +01:00
build tools build: Use $(shell ) instead of `` to get embedded libperl's ccopts 2022-05-20 15:20:03 +02:00
cgroup
debugging
firewire
firmware
gpio
hv
iio
include selftests/bpf: Extend verifier and bpf_sock tests for dst_port loads 2022-09-16 11:00:21 +02:00
io_uring
kvm/kvm_stat
laptop
leds
lib libbpf: Fix the name of a reused map 2022-10-17 15:00:43 +02:00
memory-model
nfsd
objtool x86/xen: Mark cpu_bringup_and_idle() as dead_end_function 2022-08-26 11:06:54 +02:00
pci
pcmcia
perf genelf: Use HAVE_LIBCRYPTO_SUPPORT, not the never defined HAVE_LIBCRYPTO 2022-10-17 15:01:20 +02:00
power tools/power turbostat: fix ICX DRAM power numbers 2022-08-26 11:07:14 +02:00
scripts tools: Allow proper CC/CXX/... override with LLVM=1 in Makefile.include 2021-09-20 18:49:42 +02:00
spi
testing selftests/bpf: fix a test for snprintf() overflow 2022-10-17 15:00:45 +02:00
thermal/tmon tools/thermal: Fix possible path truncations 2022-10-17 15:01:22 +02:00
time
usb usb: testusb: Fix for showing the connection speed 2021-11-12 14:04:26 +01:00
virtio
vm tools/vm/slabinfo: use alphabetic order when two values are equal 2022-10-17 15:01:45 +02:00
wmi
Makefile