How can I check the memory consume of kernel modules,some tools like top?
I've added a tcp_hook module(just like the pf)to freebsd kernel,but something goes wrong with it.The kernel always crashed one or two hours later.Backtrace the core dumped file and some messages as follow:
#0 doadump () at pcpu.h:165 #1 0xc06b2ec2 in boot (howto=260) at /usr/src/sys/kern/kern_shutdown.c:410 #2 0xc06b3158 in panic ( fmt=0xc09bf143 "kmem_malloc: entry not found or misaligned") at /usr/src/sys/kern/kern_shutdown.c:566 #3 0xc0836cd6 in kmem_malloc (map=0xc144b0c0, size=0, flags=1) at /usr/src/sys/vm/vm_kern.c:382 #4 0xc082e24e in page_alloc (zone=0x0, bytes=0, pflag=0x0, wait=1) at /usr/src/sys/vm/uma_core.c:957 #5 0xc083064b in uma_large_malloc (size=0, wait=1) at /usr/src/sys/vm/uma_core.c:2723 #6 0xc06a79ad in malloc (size=0, mtp=0xc0a1f6e0, flags=1) at /usr/src/sys/kern/kern_malloc.c:329 #7 0xc3c22f0c in Hunt() from ./tcp_input_hook.ko #8 0xc3c23565 in TcpHook() from ./tcp_input_hook.ko #9 0xc3c23682 in tcp_input_hook () from ./tcp_input_hook.ko #10 0xc07531ca in ip_input (m=0xc32aa300) at /usr/src/sys/netinet/ip_input.c:791 #11 0xc072c0a3 in netisr_processqueue (ni=0xc0a93c98) at /usr/src/sys/net/netisr.c:236 It seems that no more free memory to malloc, how can I track the memory allocation?Then to identify whether this is a memory leak caused by my code or some other reasons. Btw,I have modified my code into snort and it runs smoothly for quite a long time,the memory usage keeps a stable value.So it doesn't seems to have memory leak. 3ks for any suggestions! |
All times are GMT -5. The time now is 06:49 AM. |