After upgrading from 8-stable to 9-stable I noticed the error in malloc(9) type 80211node counter. From vmstat -m: Type InUse MemUse HighUse Requests Size(s) 80211node 18446744073709551605 18014398509481852K - 0 18446744073709551605/18014398509481852 1024.00000 18446744073709551605/2^64 .99999 2^64-18446744073709551605 11 Looks like it updates stats on free and forget to update on malloc, so it goes negative and wraps on uint64_t. (kgdb) p ((struct malloc_type_internal *)M_80211_NODE->ks_handle)->mti_stats[0] $20 = {mts_memalloced = 0, mts_memfreed = 61440, mts_numallocs = 0, mts_numfrees = 5, mts_size = 0, _mts_reserved1 = 0, _mts_reserved2 = 0, _mts_reserved3 = 0} (kgdb) p ((struct malloc_type_internal *)M_80211_NODE->ks_handle)->mti_stats[1] $21 = {mts_memalloced = 0, mts_memfreed = 73728, mts_numallocs = 0, mts_numfrees = 6, mts_size = 0, _mts_reserved1 = 0, _mts_reserved2 = 0, _mts_reserved3 = 0} (kgdb) p mp_ncpus $1 = 2 mts_numfrees[i] - mts_numallocs[i] => 11
Responsible Changed From-To: freebsd-bugs->freebsd-net Over to maintainer(s).
Still true on HEAD (11-CURRENT). 80211node 18446744073709551603 18014398509481785K - 294 1024 18446744073709551603-2^64 -13 The point of counter leaking is still to be investigated. -- wbr, pluknet
For bugs matching the following criteria: Status: In Progress Changed: (is less than) 2014-06-01 Reset to default assignee and clear in-progress tags. Mail being skipped
A commit references this bug: Author: avos Date: Sat Feb 2 16:01:17 UTC 2019 New revision: 343679 URL: https://svnweb.freebsd.org/changeset/base/343679 Log: run(4): fix allocated memory type and -Wincompatible-pointer-types compiler warning. PR: 177366 MFC after: 3 days Changes: head/sys/dev/usb/wlan/if_run.c
A commit references this bug: Author: avos Date: Sat Feb 2 16:07:56 UTC 2019 New revision: 343681 URL: https://svnweb.freebsd.org/changeset/base/343681 Log: run(4): fix allocated memory type for ieee80211_node(4). PR: 177366 MFC after: 3 days Changes: head/sys/dev/usb/wlan/if_run.c
It is not misused nowhere, except in run(4); I think, this PR may be closed after MFC.
A commit references this bug: Author: avos Date: Wed Feb 6 02:18:12 UTC 2019 New revision: 343821 URL: https://svnweb.freebsd.org/changeset/base/343821 Log: MFC r343681: run(4): fix allocated memory type for ieee80211_node(4) PR: 177366 Changes: _U stable/10/ stable/10/sys/dev/usb/wlan/if_run.c _U stable/11/ stable/11/sys/dev/usb/wlan/if_run.c _U stable/12/ stable/12/sys/dev/usb/wlan/if_run.c
If counter is still incorrect - feel free to reopen this PR (driver / wlanmode / svn revision will help to diagnose the problem in this case).