/tmp/l4check/full_tree/trunk/l4/pkg/dde_linux/lib/src/mm.c File Reference

Memory Management. More...

#include <l4/env/errno.h>
#include <l4/lock/lock.h>
#include <l4/names/libnames.h>
#include <l4/l4rm/l4rm.h>
#include <l4/dm_mem/dm_mem.h>
#include <l4/dm_phys/dm_phys.h>
#include <l4/util/list_alloc.h>
#include <l4/dde_linux/dde.h>
#include <linux/slab.h>
#include <linux/vmalloc.h>
#include "__config.h"
#include "internal.h"

Go to the source code of this file.

Functions

static __inline__ int __more_kcore (l4_size_t size)
 Simulated LMM Callback on Memory Shortage (kmem).
static __inline__ int __more_vcore (l4_size_t size)
 Simulated LMM Callback on Memory Shortage (vmem).
void * kmalloc (size_t size, int gfp)
 kmem Allocation
void kfree (const void *addr)
 kmem Deallocation
void * vmalloc (unsigned long size)
 vmem Allocation
void vfree (void *addr)
 vmem Deallocation
static int __setup_kmem (unsigned int *max, l4_addr_t *addr)
 Setup kmem pool.
static int __setup_vmem (unsigned int *max, l4_addr_t *addr)
 Setup vmem pool.
int l4dde_mm_init (unsigned int max_vsize, unsigned int max_ksize)
 Initalize LMM pools and initial regions.
int l4dde_mm_kmem_avail (void)
 Return amount of free kernel memory.
int l4dde_mm_kmem_region (unsigned num, l4_addr_t *start, l4_addr_t *end)
 Return begin and end of kmem regions.

Variables

unsigned long num_physpages = 0
 mm/memory.c
Module Variables
static int _initialized = 0
 initialization flag
static l4la_free_t * kpool = L4LA_INITIALIZER
 kmem pool
static unsigned int kregion_size
 kmem region size
static unsigned int kcount = MM_KREGIONS - 1
 kmem region counter
static l4lock_t klock = L4LOCK_UNLOCKED_INITIALIZER
 protect access to kmem pool
static l4la_free_t * vpool = L4LA_INITIALIZER
 vmem pool
static l4lock_t vlock = L4LOCK_UNLOCKED_INITIALIZER
 protect access to vmem pool


Detailed Description

Memory Management.

Date:
08/28/2003
Author:
Christian Helmuth <ch12@os.inf.tu-dresden.de>

Definition in file mm.c.


Function Documentation

static __inline__ int __more_kcore ( l4_size_t  size  )  [static]

Simulated LMM Callback on Memory Shortage (kmem).

Parameters:
size size of memory chunk needed
Returns:
0 on success, negative error code otherwise
As long as maximum region number is not exceeded new physical contiguous dataspaces are requested from a dataspace manager and attached to appropriate regions in address space by the L4 Region Mapper. The region is then added as new LMM region to the kmem LMM pool.

size is rounded up to multiples of KMEM_RSIZE.

I removed the unlock/lock around page requesting that was in the original OSKit implementation's MORECORE() macro (clientos/mem.c). Hope it's still fully functioning.

Definition at line 98 of file mm.c.

static __inline__ int __more_vcore ( l4_size_t  size  )  [static]

Simulated LMM Callback on Memory Shortage (vmem).

Parameters:
size size of memory chunk needed
Returns:
-L4_ENOMEM
This always returns "Out of memory" as we leave mappings in vmem region to l4rm and dataspace managers.

Definition at line 155 of file mm.c.

static int __setup_kmem ( unsigned int *  max,
l4_addr_t *  addr 
) [static]

Setup kmem pool.

Definition at line 290 of file mm.c.

static int __setup_vmem ( unsigned int *  max,
l4_addr_t *  addr 
) [static]

Setup vmem pool.

Definition at line 345 of file mm.c.


Linux DDE, written by Christian Helmuth  © 2003 Technische Universitaet Dresden