From owner-freebsd-bugs@FreeBSD.ORG Mon Mar 25 09:30:00 2013 Return-Path: Delivered-To: freebsd-bugs@smarthost.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id E76F038C for ; Mon, 25 Mar 2013 09:30:00 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:1900:2254:206c::16:87]) by mx1.freebsd.org (Postfix) with ESMTP id B6D4B9DA for ; Mon, 25 Mar 2013 09:30:00 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.6/8.14.6) with ESMTP id r2P9U0DR087951 for ; Mon, 25 Mar 2013 09:30:00 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.6/8.14.6/Submit) id r2P9U0cZ087950; Mon, 25 Mar 2013 09:30:00 GMT (envelope-from gnats) Resent-Date: Mon, 25 Mar 2013 09:30:00 GMT Resent-Message-Id: <201303250930.r2P9U0cZ087950@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Sergey Kandaurov Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 3B78F181 for ; Mon, 25 Mar 2013 09:27:12 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from red.freebsd.org (red.freebsd.org [IPv6:2001:4f8:fff6::22]) by mx1.freebsd.org (Postfix) with ESMTP id 2B9E49AB for ; Mon, 25 Mar 2013 09:27:12 +0000 (UTC) Received: from red.freebsd.org (localhost [127.0.0.1]) by red.freebsd.org (8.14.5/8.14.5) with ESMTP id r2P9RBsK068773 for ; Mon, 25 Mar 2013 09:27:11 GMT (envelope-from nobody@red.freebsd.org) Received: (from nobody@localhost) by red.freebsd.org (8.14.5/8.14.5/Submit) id r2P9RBx5068772; Mon, 25 Mar 2013 09:27:11 GMT (envelope-from nobody) Message-Id: <201303250927.r2P9RBx5068772@red.freebsd.org> Date: Mon, 25 Mar 2013 09:27:11 GMT From: Sergey Kandaurov To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-3.1 Subject: kern/177366: [ieee80211] negative malloc(9) statistics for 80211node X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 25 Mar 2013 09:30:01 -0000 >Number: 177366 >Category: kern >Synopsis: [ieee80211] negative malloc(9) statistics for 80211node >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Mon Mar 25 09:30:00 UTC 2013 >Closed-Date: >Last-Modified: >Originator: Sergey Kandaurov >Release: FreeBSD 9.1-STABLE >Organization: >Environment: FreeBSD omg 9.1-STABLE FreeBSD 9.1-STABLE #0: Sun Mar 24 18:49:50 MSK 2013 root@omg:/usr/obj/amd64.amd64/usr/src/sys/GENERIC amd64 >Description: 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 >How-To-Repeat: >Fix: >Release-Note: >Audit-Trail: >Unformatted: