contigfree man page on DragonFly

Man page or keyword search:  
man Server   44335 pages
apropos Keyword Search (all sections)
Output format
DragonFly logo
[printable version]

CONTIGMALLOC(9)		 BSD Kernel Developer's Manual	       CONTIGMALLOC(9)

NAME
     contigmalloc, contigfree — manage contiguous kernel physical memory

SYNOPSIS
     #include <sys/types.h>
     #include <sys/malloc.h>

     void *
     contigmalloc(unsigned long size, struct malloc_type *type, int flags,
	 vm_paddr_t low, vm_paddr_t high, unsigned long alignment,
	 unsigned long boundary);

     void
     contigfree(void *addr, unsigned long size, struct malloc_type *type);

DESCRIPTION
     The contigmalloc() function allocates size bytes of contiguous physical
     memory that is aligned to alignment bytes, and which does not cross a
     boundary of boundary bytes.  If successful, the allocation will reside
     between physical addresses low and high.  The returned pointer points to
     a wired kernel virtual address range of size bytes allocated from the
     kernel virtual address (KVA) map.	The type argument is ignored.

     The flags parameter modifies contigmalloc()'s behavior as follows:

	   M_WAITOK  Causes contigmalloc() to try flushing the active page
		     queue in its second pass.	Note that (unlike
		     kmalloc(M_WAITOK)) contigmalloc(M_WAITOK) can still
		     return NULL.

	   M_ZERO    Causes the allocated physical memory to be zero filled.

     Other flags (if present) are ignored.

     The contigfree() function deallocates memory allocated by a previous call
     to contigmalloc().

IMPLEMENTATION NOTES
     The contigmalloc() function does not sleep waiting for memory resources
     to be freed up, but instead scans available physical memory a small num‐
     ber of times for a suitably sized free address range before giving up.
     Memory allocation is done on a first-fit basis, starting from the top of
     the provided address range.

RETURN VALUES
     The contigmalloc() function returns a kernel virtual address if alloca‐
     tion succeeds, or NULL otherwise.

EXAMPLES
     void *p;
     p = contigmalloc(8192, M_DEVBUF, M_ZERO, 0, (1L << 22),
	 32 * 1024, 1024 * 1024);

     Ask for 8192 bytes of zero-filled memory residing between physical
     address 0 and 4194303 inclusive, aligned to a 32K boundary and not cross‐
     ing a 1M address boundary.

DIAGNOSTICS
     The contigmalloc() function will panic if size is zero, or if alignment
     or boundary is not a power of two.

SEE ALSO
     kmalloc(9)

BSD			       January 19, 2008				   BSD
[top]

List of man pages available for DragonFly

Copyright (c) for man pages and the logo by the respective OS vendor.

For those who want to learn more, the polarhome community provides shell access and support.

[legal] [privacy] [GNU] [policy] [cookies] [netiquette] [sponsors] [FAQ]
Tweet
Polarhome, production since 1999.
Member of Polarhome portal.
Based on Fawad Halim's script.
....................................................................
Vote for polarhome
Free Shell Accounts :: the biggest list on the net