How can I check the memory consume of kernel modules,some tools like top?
Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Introduction to Linux - A Hands on Guide
This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter.
For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own.
Click Here to receive this Complete Guide absolutely free.
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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.