Re: malloc() in kernel and increasing mbuf and cluster size

2005-10-17 Thread Sangwoo Shim
2005/10/17, kamal kc <[EMAIL PROTECTED]>: > > > 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;

Re: malloc() in kernel and increasing mbuf and cluster size

2005-10-17 Thread Daniel O'Connor
On Mon, 17 Oct 2005 21:56, kamal kc wrote: > the man pages use M_FOOBUF(where did it come from ??) > in the field type. 'foo' is a generic term for a random variable name. > Now how should i code it. > > struct malloc_type mytype; > mytype=MALLOC_DEFINE(.,"mybuffers","mybuffers"); > > what s

Re: malloc() in kernel and increasing mbuf and cluster size

2005-10-17 Thread Nick Strebkov
Hi, Kamal On 17.10.2005 04:49:01, kamal kc wrote: > this may be a trivial question for many of you > but i am confused in doing memory allocation in the > kernel. > > sys/malloc.h has function prototypes for malloc() > kern/kern_malloc.c defines the malloc() > > the malloc() definition is > >

Re: malloc() in kernel and increasing mbuf and cluster size

2005-10-17 Thread Daniel O'Connor
On Mon, 17 Oct 2005 21:19, kamal kc wrote: > 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 It is used to do basic sanity checking and f

Re: malloc() in kernel and increasing mbuf and cluster size

2005-10-17 Thread kamal kc
> > 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 fla

malloc() in kernel and increasing mbuf and cluster size

2005-10-17 Thread kamal kc
itialize the type) Next thing is that i want to make the kernel process network packets very fast. i think of increasing the mbuf and cluster size. i want to if there will be any effect on increasing the mbuf and cluster size. what would be an appropriate size of mbuf and cluster if I

Re: cluster size

2001-07-29 Thread Terry Lambert
"Jonathan M. Slivko" wrote: > > >I'm not sure if Steve Baumel (the person largely responsible for > >the SVR4 VM system) ever wrote a paper on his approach, or not, > >but with the Solaris source code available, his code is now > >available for study. > > Isn't that just the binary version, you

RE: cluster size

2001-07-29 Thread Jonathan M. Slivko
>I'm not sure if Steve Baumel (the person largely responsible for >the SVR4 VM system) ever wrote a paper on his approach, or not, >but with the Solaris source code available, his code is now >available for study. Isn't that just the binary version, you still have to buy the source? -- Jonathan

Re: cluster size

2001-07-29 Thread Terry Lambert
Zhihui Zhang wrote: > > Excellent answer! I looked at the zone allocator code almost two years > back and I wondered at that time why FreeBSD cannot allocate KVM at > interrupt time but CAN allocate physical memory at interrupt time. It > turns out there is a physical memory reserve for interrup

Re: cluster size

2001-07-29 Thread Terry Lambert
Bosko Milekic wrote: > > So, in general: > > > > 1)Only some allocators can be used at interrupt time > > 2)If they can, they must precommit kernel address space > > to the task > > 3)Once memory is allocated from one of these pools, it > > is never returned to the system f

Re: cluster size

2001-07-28 Thread Bosko Milekic
On Sat, Jul 28, 2001 at 01:44:25PM -0700, Terry Lambert wrote: > Zhihui Zhang wrote: > > I thought doing a memory free is always safe in an interrupt context. Now > > it seems doing an allocation of memory is safe too. Does MCLGET() call > > vm_page_alloc() or malloc() eventually? If so, it mig

Re: cluster size

2001-07-28 Thread Terry Lambert
Zhihui Zhang wrote: > I thought doing a memory free is always safe in an interrupt context. Now > it seems doing an allocation of memory is safe too. Does MCLGET() call > vm_page_alloc() or malloc() eventually? If so, it might block. The mbuf allocator uses the zone allocator. The reason this

Re: cluster size

2001-07-28 Thread Bosko Milekic
On Fri, Jul 27, 2001 at 08:23:37PM -0400, Zhihui Zhang wrote: > > I thought doing a memory free is always safe in an interrupt context. Now > it seems doing an allocation of memory is safe too. Does MCLGET() call > vm_page_alloc() or malloc() eventually? If so, it might block. It neve

Re: cluster size

2001-07-27 Thread Zhihui Zhang
I thought doing a memory free is always safe in an interrupt context. Now it seems doing an allocation of memory is safe too. Does MCLGET() call vm_page_alloc() or malloc() eventually? If so, it might block. -Zhihui On Thu, 26 Jul 2001, Terry Lambert wrote: > Bosko Milekic wrote: > > > > Er,

Re: cluster size

2001-07-26 Thread Terry Lambert
Bosko Milekic wrote: > > > Er, wouldn't that be the only way for cards to refil thier DMA > > > recieve buffers? > > > > Look at the Tigon II and FXP drivers. The allocations in > > the macros turn into m_get, not m_clusterget. > > From if_fxp.c (fxp_add_rfabuf(), sometimes called from f

Re: cluster size

2001-07-26 Thread Alfred Perlstein
* Terry Lambert <[EMAIL PROTECTED]> [010726 12:51] wrote: > Alfred Perlstein wrote: > > > On Thu, Jul 26, 2001 at 10:18:09AM -0700, Terry Lambert wrote: > > > > The real reason behind all this is to make the input and output > > > > routines symmetric, since mbuf's can be allocated at interrupt, >

Re: cluster size

2001-07-26 Thread Bosko Milekic
On Thu, Jul 26, 2001 at 10:51:40AM -0700, Terry Lambert wrote: > Alfred Perlstein wrote: > > > On Thu, Jul 26, 2001 at 10:18:09AM -0700, Terry Lambert wrote: > > > > The real reason behind all this is to make the input and output > > > > routines symmetric, since mbuf's can be allocated at interr

Re: cluster size

2001-07-26 Thread Terry Lambert
Alfred Perlstein wrote: > > On Thu, Jul 26, 2001 at 10:18:09AM -0700, Terry Lambert wrote: > > > The real reason behind all this is to make the input and output > > > routines symmetric, since mbuf's can be allocated at interrupt, > > > and clusters can't (or couldn't, last time I looked at 4.3).

Re: cluster size

2001-07-26 Thread Terry Lambert
Bosko Milekic wrote: > > On Thu, Jul 26, 2001 at 10:18:09AM -0700, Terry Lambert wrote: > > The real reason behind all this is to make the input and output > > routines symmetric, since mbuf's can be allocated at interrupt, > > and clusters can't (or couldn't, last time I looked at 4.3). > >

Re: cluster size

2001-07-26 Thread Alfred Perlstein
* Bosko Milekic <[EMAIL PROTECTED]> [010726 12:32] wrote: > > On Thu, Jul 26, 2001 at 10:18:09AM -0700, Terry Lambert wrote: > > The real reason behind all this is to make the input and output > > routines symmetric, since mbuf's can be allocated at interrupt, > > and clusters can't (or couldn't,

Re: cluster size

2001-07-26 Thread Bosko Milekic
On Thu, Jul 26, 2001 at 10:18:09AM -0700, Terry Lambert wrote: > The real reason behind all this is to make the input and output > routines symmetric, since mbuf's can be allocated at interrupt, > and clusters can't (or couldn't, last time I looked at 4.3). They can. Whether they are or

Re: cluster size

2001-07-26 Thread Terry Lambert
vishwanath pargaonkar wrote: > > Hi, > lets come to my question please. > tell me can i change mbuf cluster size from 2048 to > 4096?? You can do it, but it's not a really very useful thing to do, since the majority of your cluster will end up being vacant. > how shd

Re: cluster size

2001-07-26 Thread Terry Lambert
Bosko Milekic wrote: > > On Wed, Jul 25, 2001 at 02:17:38PM -0400, Zhihui Zhang wrote: > > > > I see. It has something to do with the power-of-two allocator we are > > using inside the kernel. > > No, it has nothing to do with the power-of-two allocation strategy > used in some cases in

Re: cluster size

2001-07-26 Thread Terry Lambert
Julian Elischer wrote: > > no.. it has to do with the fact that it would be unwise > to make a cluster > 1 page size since we have no guarantee that > all drivers could handle breaking up a DMA if a cluster spanned 2 > physical address ranges. (they can handle a chain of discontinuous > mbufs but

Re: cluster size

2001-07-26 Thread vishwanath pargaonkar
Hi, lets come to my question please. tell me can i change mbuf cluster size from 2048 to 4096?? how shd i do it if i can do it? --- Julian Elischer <[EMAIL PROTECTED]> wrote: > no.. it has to do with the fact that it would be > unwise > to make a cluster > 1 page siz

Re: cluster size

2001-07-25 Thread Julian Elischer
> > > > > > On Tue, 24 Jul 2001, Terry Lambert wrote: > > > > > > > Zhihui Zhang wrote: > > > > > > Hi, > > > > > > in freebsd can we change the cluster size from 2048 > > > > > > bytes.If yes how can we d

Re: cluster size

2001-07-25 Thread Bosko Milekic
On Wed, Jul 25, 2001 at 02:17:38PM -0400, Zhihui Zhang wrote: > > I see. It has something to do with the power-of-two allocator we are > using inside the kernel. No, it has nothing to do with the power-of-two allocation strategy used in some cases inside the kernel. 2K is just the most

Re: cluster size

2001-07-25 Thread Zhihui Zhang
> > > > > Zhihui Zhang wrote: > > > > > Hi, > > > > > in freebsd can we change the cluster size from 2048 > > > > > bytes.If yes how can we do that? > > > > > do we have to configure in some file? > > > > &

Re: cluster size

2001-07-25 Thread Julian Elischer
) 4096/3 is 1365 too small 4096/2=2048 ok.. 4096/1 too wasteful. On Wed, 25 Jul 2001, Zhihui Zhang wrote: > > > On Tue, 24 Jul 2001, Terry Lambert wrote: > > > Zhihui Zhang wrote: > > > > Hi, > > > > in freebsd can we change the cluster size from 20

Re: cluster size

2001-07-25 Thread Bosko Milekic
On Wed, Jul 25, 2001 at 01:51:51PM -0400, Zhihui Zhang wrote: > > > On Tue, 24 Jul 2001, Terry Lambert wrote: > > > Zhihui Zhang wrote: > > > > Hi, > > > > in freebsd can we change the cluster size from 2048 > > > > bytes.If yes how can we

Re: cluster size

2001-07-25 Thread Zhihui Zhang
On Tue, 24 Jul 2001, Terry Lambert wrote: > Zhihui Zhang wrote: > > > Hi, > > > in freebsd can we change the cluster size from 2048 > > > bytes.If yes how can we do that? > > > do we have to configure in some file? > > > > You must be asking

Re: cluster size

2001-07-24 Thread Terry Lambert
Zhihui Zhang wrote: > > Hi, > > in freebsd can we change the cluster size from 2048 > > bytes.If yes how can we do that? > > do we have to configure in some file? > > You must be asking why the mbuf cluster size is chosen as 2048, right? It > is probably a trad

Re: cluster size

2001-07-23 Thread Saju R Pillai
Hi, In case you are talking about mbuf clusters, then you will find the size mentioned in sys/mbuf.h. ( Just curious, why would you want to change the cluster size ?) Cheers __srp > On Mon, 23 Jul 2001, [iso-8859-1] vishwanath pargaonkar wrote: > > > Hi, > > in freebsd

Re: cluster size

2001-07-23 Thread Zhihui Zhang
You must be asking why the mbuf cluster size is chosen as 2048, right? It is probably a tradeoff between memory efficient and speed. -Zhihui On Mon, 23 Jul 2001, [iso-8859-1] vishwanath pargaonkar wrote: > Hi, > in freebsd can we change the cluster size from 2048 > bytes.If yes how

Re: cluster size

2001-07-23 Thread Bosko Milekic
On Mon, Jul 23, 2001 at 11:01:27AM -0500, Dan Nelson wrote: > In the last episode (Jul 23), vishwanath pargaonkar said: > > in freebsd can we change the cluster size from 2048 bytes.If yes how > > can we do that? do we have to configure in some file? > > Actually, the blo

cluster size

2001-07-23 Thread vishwanath pargaonkar
Hi, in freebsd can we change the cluster size from 2048 bytes.If yes how can we do that? do we have to configure in some file? TIA vishwanath To Unsubscribe: send mail to [EMAIL PROTECTED] with "unsubscribe freebsd-hackers" in the body of the message