Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Functions
ttm_memory.h File Reference
#include <linux/workqueue.h>
#include <linux/spinlock.h>
#include <linux/bug.h>
#include <linux/wait.h>
#include <linux/errno.h>
#include <linux/kobject.h>
#include <linux/mm.h>

Go to the source code of this file.

Data Structures

struct  ttm_mem_shrink
 
struct  ttm_mem_global
 

Macros

#define TTM_MEM_MAX_ZONES   2
 

Functions

int ttm_mem_global_init (struct ttm_mem_global *glob)
 
void ttm_mem_global_release (struct ttm_mem_global *glob)
 
int ttm_mem_global_alloc (struct ttm_mem_global *glob, uint64_t memory, bool no_wait, bool interruptible)
 
void ttm_mem_global_free (struct ttm_mem_global *glob, uint64_t amount)
 
int ttm_mem_global_alloc_page (struct ttm_mem_global *glob, struct page *page, bool no_wait, bool interruptible)
 
void ttm_mem_global_free_page (struct ttm_mem_global *glob, struct page *page)
 
size_t ttm_round_pot (size_t size)
 

Macro Definition Documentation

#define TTM_MEM_MAX_ZONES   2

struct ttm_mem_global - Global memory accounting structure.

: A single callback to shrink TTM memory usage. Extend this to a linked list to be able to handle multiple callbacks when needed. : A workqueue to handle shrinking in low memory situations. We need a separate workqueue since it will spend a lot of time waiting for the GPU, and this will otherwise block other workqueue tasks(?) At this point we use only a single-threaded workqueue. : The workqueue callback for the shrink queue. : Wait queue for processes suspended waiting for memory. : Lock to protect the - and the memory accounting members, that is, essentially the whole structure with some exceptions. : Array of pointers to accounting zones. : Number of populated entries in the array. : Pointer to the kernel zone. : Pointer to the highmem zone if there is one. : Pointer to the dma32 zone if there is one.

Note that this structure is not per device. It should be global for all graphics devices.

Definition at line 76 of file ttm_memory.h.

Function Documentation

int ttm_mem_global_alloc ( struct ttm_mem_global glob,
uint64_t  memory,
bool  no_wait,
bool  interruptible 
)

Normal allocations of kernel memory are registered in all zones.

Definition at line 535 of file ttm_memory.c.

int ttm_mem_global_alloc_page ( struct ttm_mem_global glob,
struct page page,
bool  no_wait,
bool  interruptible 
)

Page allocations may be registed in a single zone only if highmem or !dma32.

Definition at line 548 of file ttm_memory.c.

void ttm_mem_global_free ( struct ttm_mem_global glob,
uint64_t  amount 
)

Definition at line 467 of file ttm_memory.c.

void ttm_mem_global_free_page ( struct ttm_mem_global glob,
struct page page 
)

Definition at line 571 of file ttm_memory.c.

int ttm_mem_global_init ( struct ttm_mem_global glob)

Definition at line 360 of file ttm_memory.c.

void ttm_mem_global_release ( struct ttm_mem_global glob)

Definition at line 406 of file ttm_memory.c.

size_t ttm_round_pot ( size_t  size)

Definition at line 586 of file ttm_memory.c.