Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 18 Oct 2005 01:59:21 +0900
From:      Sangwoo Shim <sangwoos@gmail.com>
To:        kamal kc <kamal_ckk@yahoo.com>
Cc:        freebsd-net@freebsd.org, freebsd-hackers@freebsd.org
Subject:   Re: malloc() in kernel and increasing mbuf and cluster size
Message-ID:  <4cbd01f40510170959l30f90bc1k@mail.gmail.com>
In-Reply-To: <20051017122657.58723.qmail@web35703.mail.mud.yahoo.com>
References:  <20051017120734.GA820@taran.infoua.com.ua> <20051017122657.58723.qmail@web35703.mail.mud.yahoo.com>

next in thread | previous in thread | raw e-mail | index | archive | help
2005/10/17, kamal kc <kamal_ckk@yahoo.com>:
> > > sys/malloc.h has function prototypes for malloc()
> > > kern/kern_malloc.c defines the malloc()
> > >
> > > the malloc() definition is
> > >
> > > void *
> > > malloc(size, type, flags)
> > >     unsigned long size;
> > >     struct malloc_type *type;
> > >     int flags;
> > >
> > > i understand the size and flags but what shall i
> > > do with the malloc_type.
> >
> > man 9 malloc :-)
> >
>
> i saw the man pages.
>
> it says to use malloc_type via
>
> MALLOC_DEFINE(type,shortdesc,longdesc)
> MALLOC_DECLARE(type)
>
> the man pages use M_FOOBUF(where did it come from ??)
> in the field type.
>
> Now how should i code it.
>
> struct malloc_type  mytype;
> mytype=3DMALLOC_DEFINE(.....,"mybuffers","mybuffers");
>
> what should i put in the type field ??
>
> thanks in advance,
> kamal
malloc type is defined for some kind of statistics/trackings.
If you define some specific malloc types for your module/driver etc., you
can track the memory usage more accurately. For example, if you do vmstat -=
m
you can see how much memories are used for specific allocations by looking
at type field.

Regards,
Sangwoo Shim

>
>
>
>
>
>
>
>
> __________________________________
> Yahoo! Music Unlimited
> Access over 1 million songs. Try it free.
> http://music.yahoo.com/unlimited/
> _______________________________________________
> freebsd-hackers@freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
> To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@freebsd.org=
"
>



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4cbd01f40510170959l30f90bc1k>