Page MenuHomeFreeBSD

Track mbuf owner
Needs ReviewPublic

Authored by darius-dons.net.au on Jan 13 2016, 4:36 AM.

Details

Reviewers
None
Group Reviewers
Contributor Reviews (base)
Summary

This patch is a re-implementation of Isilon's mbuf tracking code which shows records who owns a given mbuf. It has a sysctl which produces a summary of how many buffers are owned by each.
It also adds a 'show mbuf' command to DDB.

The magic/ugliness is that it has x86 only code to look at the stack and find the caller of the mbuf function to record it as the owner.

Test Plan

Booted up a VM and run..
ls -laR / > /dev/null & sysctl kern.ipc.mbufs

a few times

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Skipped
Unit
Unit Tests Skipped

Event Timeline

darius-dons.net.au retitled this revision from to Track mbuf owner.
darius-dons.net.au updated this object.
darius-dons.net.au edited the test plan for this revision. (Show Details)
darius-dons.net.au set the repository for this revision to rS FreeBSD src repository - subversion.
cem added inline comments.
sys/x86/include/stack.h
54–74

Why not use the GCC function __builtin_return_address() instead? That should be somewhat portable to non-x86?

https://gcc.gnu.org/onlinedocs/gcc/Return-Address.html

Clang/LLVM support the macros as well (for X86 since LLVM2.5):

https://github.com/llvm-mirror/clang/blob/master/test/Sema/builtin-stackaddress.c

sys/x86/include/stack.h
54–74

Wow, that looks like exactly what I want :)
I'll update the patch.