From: Russell Senior <russell@personaltelco.net>
To: The list for a Better Approach To Mobile Ad-hoc Networking
<b.a.t.m.a.n@lists.open-mesh.org>
Cc: Antonio Quartulli <antonio@meshcoding.com>
Subject: Re: [B.A.T.M.A.N.] [PATCH maint] batman-adv: release vlan object after checking the CRC
Date: Mon, 27 Jan 2014 10:43:19 -0800 [thread overview]
Message-ID: <86zjmhfepk.fsf@coulee.tdb.com> (raw)
In-Reply-To: <1390746256-551-1-git-send-email-antonio@meshcoding.com> (Antonio Quartulli's message of "Sun\, 26 Jan 2014 15\:24\:16 +0100")
>>>>> "Antonio" == Antonio Quartulli <antonio@meshcoding.com> writes:
Antonio> There is a refcounter unbalance in the CRC checking routine
Antonio> invoked on OGM reception. A vlan object is retrieved (thus
Antonio> its refcounter is increased by one) but it is never properly
Antonio> released. This leads to a memleak because the vlan object
Antonio> will never be free'd.
Antonio> Fix this by releasing the vlan object after having read the
Antonio> CRC.
Antonio> Reported-by: Russell Senior <russell@personaltelco.net>
Antonio> [...]
I am still seeing a kernel memory leak, even with this patch.
My test configuration is a Ubiquiti AirRouter (ar71xx) on OpenWrt r39397 with
this patch and the MTU patch on one end, and a Soekris net4826 (x86)
on the same OpenWrt r39397 revision and patchs on the other end
(kmemleak also enabled on the x86 end, not on the ar71xx end).
The airrouter, with the bat0 interface disabled, has a /proc/meminfo
that looks like this right after boot:
root@ar0:/# cat /proc/meminfo
MemTotal: 29044 kB
MemFree: 8220 kB
Buffers: 2164 kB
Cached: 6176 kB
SwapCached: 0 kB
Active: 4624 kB
Inactive: 5672 kB
Active(anon): 1984 kB
Inactive(anon): 20 kB
Active(file): 2640 kB
Inactive(file): 5652 kB
Unevictable: 0 kB
Mlocked: 0 kB
SwapTotal: 0 kB
SwapFree: 0 kB
Dirty: 0 kB
Writeback: 0 kB
AnonPages: 1972 kB
Mapped: 1872 kB
Shmem: 48 kB
Slab: 4928 kB
SReclaimable: 932 kB
SUnreclaim: 3996 kB
KernelStack: 272 kB
PageTables: 188 kB
NFS_Unstable: 0 kB
Bounce: 0 kB
WritebackTmp: 0 kB
CommitLimit: 14520 kB
Committed_AS: 3992 kB
VmallocTotal: 1048372 kB
VmallocUsed: 1476 kB
VmallocChunk: 1043448 kB
With bat0 enabled, however, the AirRouter will begin to become
unresponsive at around 7m15s after boot and then OOM and reboot within
9 minutes of uptime. Using "watch -d cat /proc/meminfo", I see
MemFree first erode, then it begin to chew into Buffers and Cached
until supreme unhappiness ensues.
On the x86 side, I see some activity from kmemleak, which
substantially goes away when batman-adv does not have a peer. The
unreferenced objects that show up in /sys/kernel/debug/kmemleak look
like this (only a sample):
unreferenced object 0xc2eab000 (size 184):
comm "softirq", pid 0, jiffies 33396 (age 692.960s)
hex dump (first 32 bytes):
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00 00 00 00 00 00 3c c2 00 00 00 00 00 00 00 00 ......<.........
backtrace:
[<c10039b9>] print_context_stack+0x99/0xb0
[<c108cf00>] kmem_cache_alloc+0xd0/0xf0
[<c12eedc9>] build_skb+0x29/0x140
[<c12eedc9>] build_skb+0x29/0x140
[<c12f1a86>] __netdev_alloc_skb+0x56/0xd0
[<c4c020b2>] ath_rxbuf_alloc+0x22/0x80 [ath]
[<c1372619>] free_debug_processing+0x14c/0x190
[<c4c42204>] ath5k_stop+0xd4/0xc90 [ath5k]
[<c4c43773>] ath5k_beacon_update_timers+0x9b3/0x9d0 [ath5k]
[<c4c02a8f>] ath_hw_cycle_counters_update+0xcf/0x130 [ath]
[<c108c727>] kmem_cache_free+0xe7/0x100
[<c105ccfa>] __rcu_process_callbacks+0x5a/0x70
[<c102d62e>] tasklet_action+0x3e/0x70
[<c102dac5>] __do_softirq+0x85/0x140
[<c102da40>] __do_softirq+0x0/0x140
[<c102dc42>] irq_exit+0x32/0x50
unreferenced object 0xc0c1c600 (size 184):
comm "softirq", pid 0, jiffies 33490 (age 692.020s)
hex dump (first 32 bytes):
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00 00 00 00 00 00 3c c2 00 00 00 00 00 00 00 00 ......<.........
backtrace:
[<c10039b9>] print_context_stack+0x99/0xb0
[<c108cf00>] kmem_cache_alloc+0xd0/0xf0
[<c12eedc9>] build_skb+0x29/0x140
[<c12eedc9>] build_skb+0x29/0x140
[<c12f1a86>] __netdev_alloc_skb+0x56/0xd0
[<c4c020b2>] ath_rxbuf_alloc+0x22/0x80 [ath]
[<c1372619>] free_debug_processing+0x14c/0x190
[<c4c42204>] ath5k_stop+0xd4/0xc90 [ath5k]
[<c4c43773>] ath5k_beacon_update_timers+0x9b3/0x9d0 [ath5k]
[<c108c727>] kmem_cache_free+0xe7/0x100
[<c105ccfa>] __rcu_process_callbacks+0x5a/0x70
[<c102d62e>] tasklet_action+0x3e/0x70
[<c102dac5>] __do_softirq+0x85/0x140
[<c102da40>] __do_softirq+0x0/0x140
[<c102dc42>] irq_exit+0x32/0x50
[<c1002b4d>] do_IRQ+0x8d/0xb0
Memory is disappearing at a faster rate than is accounted for here
(size 184 bytes at a time). The OOM-reboot rate indicates memory is
being consumed at a rate on the order of 30-40 kB per second.
My OpenWrt diffconfig is as follows:
CONFIG_TARGET_x86=y
CONFIG_TARGET_x86_generic=y
CONFIG_TARGET_x86_generic_Soekris48xx=y
CONFIG_DEVEL=y
CONFIG_ALFRED_NEEDS_lua=y
CONFIG_BUILD_LOG=y
CONFIG_DOWNLOAD_FOLDER="/usr/portage/distfiles"
CONFIG_KMOD_BATMAN_ADV_BATCTL=y
CONFIG_KMOD_BATMAN_ADV_BLA=y
CONFIG_KMOD_BATMAN_ADV_DAT=y
CONFIG_KMOD_BATMAN_ADV_DEBUG_LOG=y
CONFIG_LIBCURL_FILE=y
CONFIG_LIBCURL_FTP=y
CONFIG_LIBCURL_HTTP=y
CONFIG_LIBCURL_POLARSSL=y
CONFIG_OPENSSL_WITH_EC=y
CONFIG_PACKAGE_ALFRED_BATHOSTS=y
CONFIG_PACKAGE_ALFRED_VIS=y
CONFIG_PACKAGE_MAC80211_DEBUGFS=y
CONFIG_PACKAGE_MAC80211_MESH=y
CONFIG_PACKAGE_alfred=y
CONFIG_PACKAGE_bridge=y
CONFIG_PACKAGE_crda=y
CONFIG_PACKAGE_curl=y
CONFIG_PACKAGE_diffutils=y
# CONFIG_PACKAGE_dnsmasq is not set
# CONFIG_PACKAGE_firewall is not set
CONFIG_PACKAGE_horst=y
CONFIG_PACKAGE_hostapd-common=y
CONFIG_PACKAGE_iftop=y
CONFIG_PACKAGE_ip=y
CONFIG_PACKAGE_iw=y
CONFIG_PACKAGE_iwinfo=y
CONFIG_PACKAGE_kmod-ath=y
CONFIG_PACKAGE_kmod-ath5k=y
CONFIG_PACKAGE_kmod-batman-adv=y
CONFIG_PACKAGE_kmod-bridge=y
CONFIG_PACKAGE_kmod-cfg80211=y
CONFIG_PACKAGE_kmod-crypto-aes=y
CONFIG_PACKAGE_kmod-crypto-arc4=y
CONFIG_PACKAGE_kmod-crypto-core=y
CONFIG_PACKAGE_kmod-crypto-crc32c=y
CONFIG_PACKAGE_kmod-crypto-hash=y
# CONFIG_PACKAGE_kmod-lib-crc-ccitt is not set
CONFIG_PACKAGE_kmod-lib-crc16=y
CONFIG_PACKAGE_kmod-lib-crc32c=y
CONFIG_PACKAGE_kmod-llc=y
CONFIG_PACKAGE_kmod-mac80211=y
# CONFIG_PACKAGE_kmod-ppp is not set
CONFIG_PACKAGE_kmod-stp=y
CONFIG_PACKAGE_libcurl=y
CONFIG_PACKAGE_libelf1=y
CONFIG_PACKAGE_libiwinfo=y
CONFIG_PACKAGE_liblua=y
CONFIG_PACKAGE_libncurses=y
CONFIG_PACKAGE_libnetsnmp=y
CONFIG_PACKAGE_libopenssl=y
CONFIG_PACKAGE_libpcap=y
CONFIG_PACKAGE_libpcre=y
CONFIG_PACKAGE_libpolarssl=y
CONFIG_PACKAGE_libpopt=y
CONFIG_PACKAGE_libpthread=y
CONFIG_PACKAGE_librt=y
CONFIG_PACKAGE_lua=y
CONFIG_PACKAGE_missnet-node=y
# CONFIG_PACKAGE_odhcp6c is not set
# CONFIG_PACKAGE_ppp is not set
CONFIG_PACKAGE_procps=y
CONFIG_PACKAGE_procps-free=y
CONFIG_PACKAGE_procps-pgrep=y
CONFIG_PACKAGE_procps-pkill=y
CONFIG_PACKAGE_procps-pmap=y
CONFIG_PACKAGE_procps-ps=y
CONFIG_PACKAGE_procps-pwdx=y
CONFIG_PACKAGE_procps-skill=y
CONFIG_PACKAGE_procps-slabtop=y
CONFIG_PACKAGE_procps-snice=y
CONFIG_PACKAGE_procps-tload=y
CONFIG_PACKAGE_procps-top=y
CONFIG_PACKAGE_procps-vmstat=y
CONFIG_PACKAGE_procps-w=y
CONFIG_PACKAGE_procps-watch=y
CONFIG_PACKAGE_rsync=y
CONFIG_PACKAGE_snmpd=y
CONFIG_PACKAGE_tcpdump=y
CONFIG_PACKAGE_terminfo=y
CONFIG_PACKAGE_traceroute6=y
CONFIG_PACKAGE_wget=y
CONFIG_PACKAGE_wireless-tools=y
CONFIG_PACKAGE_wpad-mini=y
CONFIG_PACKAGE_zlib=y
# CONFIG_TARGET_ROOTFS_EXT4FS is not set
# CONFIG_TARGET_ROOTFS_TARGZ is not set
Anything you are interested in that I left out, I'm happy to provide
on request.
--
Russell Senior, President
russell@personaltelco.net
next prev parent reply other threads:[~2014-01-27 18:43 UTC|newest]
Thread overview: 37+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-01-21 10:22 [B.A.T.M.A.N.] [PATCH maint] batman-adv: fix soft-interface MTU computation Antonio Quartulli
2014-01-21 10:31 ` Antonio Quartulli
2014-01-27 7:57 ` Marek Lindner
2014-01-21 18:43 ` Russell Senior
2014-01-21 19:00 ` Antonio Quartulli
2014-01-22 6:04 ` Russell Senior
2014-01-22 7:03 ` Antonio Quartulli
2014-01-22 7:04 ` [B.A.T.M.A.N.] memleak (Was: [PATCH maint] batman-adv: fix soft-interface MTU computation) Antonio Quartulli
2014-01-22 7:37 ` [B.A.T.M.A.N.] [PATCH maint] batman-adv: fix soft-interface MTU computation Daniel
2014-01-22 17:45 ` [B.A.T.M.A.N.] batman-adv: memory leak? Russell Senior
2014-01-22 17:46 ` Antonio Quartulli
2014-01-22 19:18 ` Russell Senior
2014-01-22 20:49 ` cmsv
2014-01-22 23:57 ` Russell Senior
2014-01-23 0:10 ` cmsv
2014-01-23 3:35 ` Daniel
2014-01-26 12:57 ` Daniel
2014-01-26 14:21 ` Antonio Quartulli
2014-01-26 14:24 ` [B.A.T.M.A.N.] [PATCH maint] batman-adv: release vlan object after checking the CRC Antonio Quartulli
2014-01-27 18:43 ` Russell Senior [this message]
2014-01-26 16:05 ` [B.A.T.M.A.N.] batman-adv: memory leak? cmsv
2014-01-26 16:07 ` Antonio Quartulli
2014-01-26 16:13 ` Antonio Quartulli
2014-01-27 17:55 ` cmsv
2014-01-28 1:21 ` Russell Senior
2014-01-28 1:30 ` cmsv
2014-01-29 8:10 ` Russell Senior
2014-01-29 21:48 ` cmsv
2014-02-08 3:08 ` cmsv
2014-02-08 10:53 ` Felix Fietkau
2014-02-12 7:23 ` Antonio Quartulli
2014-02-12 10:40 ` cmsv
2014-02-12 11:41 ` Antonio Quartulli
2014-02-13 0:55 ` cmsv
2014-02-13 7:23 ` Antonio Quartulli
2014-01-28 1:06 [B.A.T.M.A.N.] [PATCH maint] batman-adv: release vlan object after checking the CRC Antonio Quartulli
2014-01-29 4:45 ` Marek Lindner
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=86zjmhfepk.fsf@coulee.tdb.com \
--to=russell@personaltelco.net \
--cc=antonio@meshcoding.com \
--cc=b.a.t.m.a.n@lists.open-mesh.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).