Actions
Bug #7563
opennetstat shows STREAMS memory statistics incorrect
Status:
New
Priority:
Low
Assignee:
-
Category:
cmd - userland programs
Start date:
2016-11-10
Due date:
% Done:
0%
Estimated time:
Difficulty:
Medium
Tags:
needs-triage
Gerrit CR:
Description
On a high-load systems netstat -m shows the statistics incorrect.
In function m_report() the variable total_bytes cannot be negative,
this function uses kmem_cache_stats() to retrieve data from the kernel.
kstat_named_value() returns uint64_t values but we assign it to int variables
and on high-load systems they overflow.
viola% netstat -mv streams allocation: cumulative allocation current maximum total failures streams 125 190 420952 0 queues 289 360 769324 0 mblk 9232 215512 75119975 0 dblk_16 57 527 63113958 0 dblk_80 265 2820 2962822306 0 dblk_144 15 1800 2354804187 0 dblk_208 182 984 1670977 0 dblk_272 3 1090 682975 0 dblk_336 4 1104 252409 0 dblk_528 2 186 1160903 0 dblk_1040 0 203658 146710647 112 dblk_1488 0 145 13739695 0 dblk_1936 0 122 4606518 0 dblk_2576 0 582 3519923 0 dblk_3856 0 8 2048 0 dblk_8192 0 93 125149 0 dblk_12048 0 8 978 0 dblk_16384 0 62 16027 0 dblk_20240 0 7 42789 0 dblk_24576 0 31 104 0 dblk_28432 0 6 52 0 dblk_32768 0 31 49 0 dblk_36624 0 6 35 0 dblk_40960 0 31 28 0 dblk_44816 0 5 26 0 dblk_49152 0 31 24 0 dblk_53008 0 6 30 0 dblk_57344 0 31 14 0 dblk_61200 0 4 28 0 dblk_65536 0 62 782 0 dblk_69392 0 5 99 0 dblk_73728 0 31 34 0 dblk_esb 8704 8742 496565044 0 dblk_total 9232 222218 -2540096754 112 linkblk 9 83 10 0 syncq 8 25 29 0 qband 0 0 0 0 8619 Kbytes allocated for streams data
To solve this issue I offer you a patch, see the attach and this is the result:
viola% ./netstat -mv streams allocation: cumulative allocation current maximum total failures streams 125 190 421034 0 queues 289 360 769474 0 mblk 9605 215512 75165785 0 dblk_16 57 527 63155038 0 dblk_80 565 2820 7271559148 0 dblk_144 65 1800 2359978378 0 dblk_208 183 984 1671792 0 dblk_272 9 1090 683709 0 dblk_336 2 1104 253763 0 dblk_528 2 186 1163463 0 dblk_1040 0 203658 146823868 112 dblk_1488 0 145 13953448 0 dblk_1936 0 122 4676228 0 dblk_2576 0 582 3520081 0 dblk_3856 0 8 2048 0 dblk_8192 0 93 125151 0 dblk_12048 0 8 978 0 dblk_16384 0 62 16029 0 dblk_20240 0 7 42789 0 dblk_24576 0 31 104 0 dblk_28432 0 6 52 0 dblk_32768 0 31 49 0 dblk_36624 0 6 35 0 dblk_40960 0 31 28 0 dblk_44816 0 5 26 0 dblk_49152 0 31 24 0 dblk_53008 0 6 30 0 dblk_57344 0 31 14 0 dblk_61200 0 4 28 0 dblk_65536 0 62 782 0 dblk_69392 0 5 99 0 dblk_73728 0 31 34 0 dblk_esb 8704 8742 13409629498 0 dblk_total 9587 222218 23277256714 112 linkblk 9 83 10 0 syncq 8 25 29 0 qband 0 0 0 0 8689 Kbytes allocated for streams data
Maybe this tool has this issue somewhere else, I did not test it.
Files
No data to display
Actions