Quick Reference

The functions and symbols related to memory allocation are listed below:

#include <linux/malloc.h> , void *kmalloc(unsigned int size, int priority); , void kfree(void *obj);

The most frequently used interface to memory allocation.

#include <linux/mm.h> , GFP_KERNEL , GFP_ATOMIC , GFP_DMA

kmalloc priorities. GFP_DMA is a flag that can be ORed to either GFP_KERNEL or GFP_ATOMIC.

unsigned long get_free_page(int priority); , unsigned long __get_free_page(int priority); , unsigned long __get_dma_pages(int priority, ,                               unsigned long order); , unsigned long __get_free_pages(int priority, ,                                unsigned long order, ,                                int dma);

The page-oriented allocation functions. The underscore-prefixed functions don’t clear the page(s). Only the former two functions are portable across Linux 1.2 and 2.0, because the latter two behaved differently in 1.2.

void free_page(unsigned long addr); , void free_pages(unsigned long addr, unsigned long order);

These functions release page-oriented allocations.

void * vmalloc(unsigned long size); , void * vremap(unsigned long offset, unsigned long size); , void vfree(void * addr);

These functions allocate or free a contiguous virtual address space. vremap accesses physical memory through virtual addresses (and is called ioremap in Linux 2.1), while vmalloc allocates free pages. In either case, the pages are released with vfree. Linux 2.1 introduced the header <linux/vmalloc.h>, which you must include to use these functions.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.145.65.134