Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Typedefs | Functions | Variables
slob.c File Reference
#include <linux/kernel.h>
#include <linux/slab.h>
#include "slab.h"
#include <linux/mm.h>
#include <linux/swap.h>
#include <linux/cache.h>
#include <linux/init.h>
#include <linux/export.h>
#include <linux/rcupdate.h>
#include <linux/list.h>
#include <linux/kmemleak.h>
#include <trace/events/kmem.h>
#include <linux/atomic.h>

Go to the source code of this file.

Data Structures

struct  slob_block
struct  slob_rcu


#define SLOB_BREAK1   256
#define SLOB_BREAK2   1024
#define SLOB_UNIT   sizeof(slob_t)
#define SLOB_UNITS(size)   (((size) + SLOB_UNIT - 1)/SLOB_UNIT)


typedef s16 slobidx_t
typedef struct slob_block slob_t


void__kmalloc_node (size_t size, gfp_t gfp, int node)
 EXPORT_SYMBOL (__kmalloc_node)
void kfree (const void *block)
size_t ksize (const void *block)
int __kmem_cache_create (struct kmem_cache *c, unsigned long flags)
voidkmem_cache_alloc_node (struct kmem_cache *c, gfp_t flags, int node)
 EXPORT_SYMBOL (kmem_cache_alloc_node)
void kmem_cache_free (struct kmem_cache *c, void *b)
 EXPORT_SYMBOL (kmem_cache_free)
unsigned int kmem_cache_size (struct kmem_cache *c)
 EXPORT_SYMBOL (kmem_cache_size)
int __kmem_cache_shutdown (struct kmem_cache *c)
int kmem_cache_shrink (struct kmem_cache *d)
 EXPORT_SYMBOL (kmem_cache_shrink)
void __init kmem_cache_init (void)
void __init kmem_cache_init_late (void)


struct kmem_cache kmem_cache_boot

Macro Definition Documentation


Definition at line 127 of file slob.c.

#define SLOB_BREAK1   256

Definition at line 99 of file slob.c.

#define SLOB_BREAK2   1024

Definition at line 100 of file slob.c.

#define SLOB_UNIT   sizeof(slob_t)

Definition at line 125 of file slob.c.

#define SLOB_UNITS (   size)    (((size) + SLOB_UNIT - 1)/SLOB_UNIT)

Definition at line 126 of file slob.c.

Typedef Documentation

Definition at line 94 of file slob.c.

typedef s16 slobidx_t

Definition at line 86 of file slob.c.

Function Documentation

void* __kmalloc_node ( size_t  size,
gfp_t  gfp,
int  node 

Definition at line 472 of file slob.c.

int __kmem_cache_create ( struct kmem_cache c,
unsigned long  flags 

Definition at line 532 of file slob.c.

int __kmem_cache_shutdown ( struct kmem_cache c)

Definition at line 617 of file slob.c.

EXPORT_SYMBOL ( __kmalloc_node  )
EXPORT_SYMBOL ( kfree  )
EXPORT_SYMBOL ( ksize  )
EXPORT_SYMBOL ( kmem_cache_alloc_node  )
EXPORT_SYMBOL ( kmem_cache_free  )
EXPORT_SYMBOL ( kmem_cache_size  )
EXPORT_SYMBOL ( kmem_cache_shrink  )
void kfree ( const void block)

kfree - free previously allocated memory : pointer returned by kmalloc.

If is NULL, no operation is performed.

Don't free memory not originally allocated by kmalloc() or you will run into trouble.

Definition at line 493 of file slob.c.

void* kmem_cache_alloc_node ( struct kmem_cache c,
gfp_t  flags,
int  node 

Definition at line 551 of file slob.c.

void kmem_cache_free ( struct kmem_cache c,
void b 

kmem_cache_free - Deallocate an object : The cache the allocation was from. : The previously allocated object.

Free an object which was previously allocated from this cache.

Definition at line 595 of file slob.c.

void __init kmem_cache_init ( void  )

Definition at line 636 of file slob.c.

void __init kmem_cache_init_late ( void  )

Definition at line 642 of file slob.c.

int kmem_cache_shrink ( struct kmem_cache d)

kmem_cache_shrink - Shrink a cache. : The cache to shrink.

Releases as many slabs as possible for a cache. To help debugging, a zero exit status indicates all slabs were released.

Definition at line 623 of file slob.c.

unsigned int kmem_cache_size ( struct kmem_cache c)

Definition at line 611 of file slob.c.

size_t ksize ( const void block)

ksize - get the actual amount of memory allocated for a given object : Pointer to the object

kmalloc may internally round up allocations and return more memory than requested. ksize() can be used to determine the actual amount of memory allocated. The caller may use this additional memory, even though a smaller amount of memory was initially specified with the kmalloc call. The caller must guarantee that objp points to a valid object previously allocated with either kmalloc() or kmem_cache_alloc(). The object must not be freed during the duration of the call.

Definition at line 514 of file slob.c.

Variable Documentation

struct kmem_cache kmem_cache_boot
Initial value:
= {
.name = "kmem_cache",
.size = sizeof(struct kmem_cache),

Definition at line 629 of file slob.c.