Skip to Content
Linux Device Drivers, Second Edition
book

Linux Device Drivers, Second Edition

by Jonathan Corbet, Alessandro Rubini
June 2001
Intermediate to advanced content levelIntermediate to advanced
592 pages
19h 20m
English
O'Reilly Media, Inc.
Content preview from Linux Device Drivers, Second Edition

Quick Reference

The functions and symbols related to memory allocation follow.

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

The most frequently used interface to memory allocation.

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

kmalloc flags. __GFP_DMA and __GFP_HIGHMEM are flags that can be OR’d to either GFP_KERNEL or GFP_ATOMIC.

#include <linux/malloc.h> , kmem_cache_t *kmem_cache_create(char *name, size_t size, size_t offset, unsigned long flags, constructor(), destructor()); , int kmem_cache_destroy(kmem_cache_t *cache);

Create and destroy a slab cache. The cache can be used to allocate several objects of the same size.

SLAB_NO_REAP , SLAB_HWCACHE_ALIGN , SLAB_CACHE_DMA

Flags that can be specified while creating a cache.

SLAB_CTOR_ATOMIC , SLAB_CTOR_CONSTRUCTOR

Flags that the allocator can pass to the constructor and the destructor functions.

void *kmem_cache_alloc(kmem_cache_t *cache, int flags); , void kmem_cache_free(kmem_cache_t *cache, const void *obj);

Allocate and release a single object from the cache.

unsigned long get_zeroed_page(int flags); , unsigned long __get_free_page(int flags); , unsigned long __get_free_pages(int flags, unsigned long order); , unsigned long __get_dma_pages(int flags, unsigned long order);

The page-oriented allocation functions. get_zeroed_page returns a single, zero-filled page. All the other versions of the call ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Linux Device Drivers, 3rd Edition

Linux Device Drivers, 3rd Edition

Jonathan Corbet, Alessandro Rubini, Greg Kroah-Hartman

Publisher Resources

ISBN: 0596000081Supplemental ContentCatalog PageErrata