Re: kernel malloc() and free()

2010-03-02 Thread Andrey Simonenko
On Mon, Mar 01, 2010 at 09:24:40PM -0600, Dan Nelson wrote: > Hm. Even after some reading, I'm not sure how the slabs keep track of which > elements are allocated or free. I expected to find a bitmap somewhere that > malloc() sets and free() clears, but I don't see it. Maybe some kernel > hacke

Re: kernel malloc() and free()

2010-03-01 Thread Dan Nelson
in the file uma_int.h, but I don't quite > understand the relation between slabs, zones and keg. How do we determine > the size of the memory that we are trying to free from given the virtual > address? I'm not too familiar with the kernel malloc, but it looks like each keg holds

kernel malloc() and free()

2010-03-01 Thread Shrivatsan
Hi, I am looking at the code that allocates and frees kernel memory. I understand that allocating kernel memory is quite different from the user level mallocs. In case of user level mallocs, we allocate requested size + 4 bytes and store the requested size in the additional 4 bytes. However,

Re: kernel malloc usage

2004-12-15 Thread Brooks Davis
On Thu, Dec 16, 2004 at 04:39:27AM +0300, Kenny Chamber wrote: > I have a question concerning the use of malloc to allocate small amounts > of memory for packet wrappers for certain packets. > Basically, I'm using malloc in much the same way as one would use it in > a standard userland program: all

kernel malloc usage

2004-12-15 Thread Kenny Chamber
I have a question concerning the use of malloc to allocate small amounts of memory for packet wrappers for certain packets. Basically, I'm using malloc in much the same way as one would use it in a standard userland program: allocating small chunks and freeing them again a short(ish) time later. A

Re: kernel malloc usage

2003-11-03 Thread Bruce M Simpson
On Mon, Nov 03, 2003 at 10:51:58AM +0100, Gerald Heinig wrote: > Is this true? I seem to remember that FreeBSD has a slab allocator, > which IIRC is particularly good at allocating small chunks. You don't specify which version of the kernel you're programming to; so I'll assume 5.x. If your alloc

kernel malloc usage

2003-11-03 Thread Gerald Heinig
Hi all, I have a question concerning the use of malloc to allocate small amounts of memory for packet wrappers for certain packets. Basically, I'm using malloc in much the same way as one would use it in a standard userland program: allocating small chunks and freeing them again a short(ish) time

kernel malloc usage

2003-11-02 Thread Gerald Heinig
Hi all, I have a question concerning the use of malloc to allocate small amounts of memory for packet wrappers for certain packets. Basically, I'm using malloc in much the same way as one would use it in a standard userland program: allocating small chunks and freeing them again a short(ish) time

Re: GFP_NOFS alternative/information for FreeBSD Kernel Malloc

2002-06-01 Thread Alfred Perlstein
* Hiten Pandya <[EMAIL PROTECTED]> [020601 09:35] wrote: > > As of now, I have changed this to just use M_WAITOK and malloc() call, but > I was wondering if anyone can guide me on this GFP_NOFS alternative. Also, > Alfred to told me on IRC to just #define M_NOFS 0 for now, and then worry > about

GFP_NOFS alternative/information for FreeBSD Kernel Malloc

2002-06-01 Thread Hiten Pandya
Hi All. I was wondering if there is an alternative to the GFP_NOFS flag provided in Linux Kernel Malloc [kmalloc() & kfree()] for FreeBSD, or is there any info. I am missing? Linux calls the kmalloc() system call as: [ an extract from jfs_dtree.c (jfs4bsd) ] %%% ciKey.name = (wch

Re: kernel malloc questions...

2001-11-15 Thread Terry Lambert
Chris Ptacek wrote: > I am trying to malloc a large amount of memory for a KLD during load and the > malloc keeps failing. I am trying to malloc 64-128MB for a memory pool for > a project I am working on. My system has 196MB of memory and the KLD is > loaded at startup so I am relativly sure tha

Re: kernel malloc questions...

2001-11-15 Thread Alfred Perlstein
* Chris Ptacek <[EMAIL PROTECTED]> [05 15:22] wrote: > Hey all, I have a couple questions about kernel mallocs. > > I am trying to malloc a large amount of memory for a KLD during load and the > malloc keeps failing. I am trying to malloc 64-128MB for a memory pool for > a project I am worki

Re: kernel malloc

2001-07-23 Thread Bosko Milekic
On Mon, Jul 23, 2001 at 12:37:55PM +0100, vishwanath pargaonkar wrote: > Hi, > > thx for ur reply. > i wanted to know in side kernel is there any limit to > the malloc that a user can do.what you told in ur > previous mail is that at a time user can malloc 4k.but No. You _can_ malloc ov

Re: kernel malloc

2001-07-23 Thread vishwanath pargaonkar
Hi, thx for ur reply. i wanted to know in side kernel is there any limit to the malloc that a user can do.what you told in ur previous mail is that at a time user can malloc 4k.but suppose i am doing 2k memory allocations. how many such mallocs i can do? is there any configuration we can do depen

Re: kernel malloc

2001-07-20 Thread Bosko Milekic
On Fri, Jul 20, 2001 at 10:17:20AM +0100, vishwanath pargaonkar wrote: > Hi, > > can any one please help me with this. i want allocate > a memory in the kernel -a buffer of size 2k to 5k. > can i do it using malloc with second parameter as > M_TEMP and third as M_WAITOK. > > can anybody tell me

kernel malloc

2001-07-20 Thread vishwanath pargaonkar
Hi, can any one please help me with this. i want allocate a memory in the kernel -a buffer of size 2k to 5k. can i do it using malloc with second parameter as M_TEMP and third as M_WAITOK. can anybody tell me what M_TEMP means .what is maximum malloc i can do with M_TEMP? will the OS allow me to

Re: Kernel malloc problems with M_NOWAIT.

2001-04-12 Thread Alfred Perlstein
* Logan Gabriel <[EMAIL PROTECTED]> [010412 11:50] wrote: > There is a hard to duplicate race condition in freebsd's > kernel malloc. Bassically it is possiables for the kernel > to tsleep way down in vm_page_sleep_busy even when M_NOWAIT > is spefcied. Under some co

Kernel malloc problems with M_NOWAIT.

2001-04-12 Thread Logan Gabriel
There is a hard to duplicate race condition in freebsd's kernel malloc. Bassically it is possiables for the kernel to tsleep way down in vm_page_sleep_busy even when M_NOWAIT is spefcied. Under some conditions this can block the kernel completly. Attatched is a kernel module

new kernel MALLOC flag.

2000-07-18 Thread Alfred Perlstein
I was wondering if we could pass an additional flag to malloc M_NOPHYS that would mean the kernel is free to move the physical location of the memory. It would signify things that the memory: 1) won't be used for backing DMA. 2) won't be entered into another kernel memory map. This will allo

Re: Kernel malloc problem?

1999-08-10 Thread Daniel O'Connor
On 11-Aug-99 Matthew Dillon wrote: > If the interrupt scans or in any way accesses the buffer list, > you have to disable interrupts temporarily using the appropriate > spl*() calls whenever your non-interrupt code (i.e. the ioctl code) > makes modifications to the list. Other

Re: Kernel malloc problem?

1999-08-10 Thread Matthew Dillon
:size - to be malloc'ed. The tail queue holding the newly- :allocated buffers is a local copy, and not subject to change :in the event of an interrupt meant for the driver. Given If the interrupt scans or in any way accesses the buffer list, you have to disable interrupts temporarily using

Re: Kernel malloc problem?

1999-08-10 Thread Daniel O'Connor
On 11-Aug-99 Matthew Dillon wrote: > If the interrupt scans or in any way accesses the buffer list, > you have to disable interrupts temporarily using the appropriate > spl*() calls whenever your non-interrupt code (i.e. the ioctl code) > makes modifications to the list. Othe

Kernel malloc problem?

1999-08-10 Thread Daniel O'Connor
We are experiencing what appears to be a memory corruption problem with a kernel device driver running under FreeBSD 2.2.8-STABLE with the CAM patches. The driver manages a series of memory buffers implemented using a singly-linked tail list. The number and size of buffers may be changed via an io

Re: Kernel malloc problem?

1999-08-10 Thread Matthew Dillon
:size - to be malloc'ed. The tail queue holding the newly- :allocated buffers is a local copy, and not subject to change :in the event of an interrupt meant for the driver. Given If the interrupt scans or in any way accesses the buffer list, you have to disable interrupts temporarily usin

Kernel malloc problem?

1999-08-10 Thread Daniel O'Connor
We are experiencing what appears to be a memory corruption problem with a kernel device driver running under FreeBSD 2.2.8-STABLE with the CAM patches. The driver manages a series of memory buffers implemented using a singly-linked tail list. The number and size of buffers may be changed via an i