参照元†
- size_t size
- 確保するメモリの大きさ(バイト単位)
- struct agp_memory *mem
返り値†
/*
* Use kmalloc if possible for the page list. Otherwise fall back to
* vmalloc. This speeds things up and also saves memory for small AGP
* regions.
*/
void agp_alloc_page_array(size_t size, struct agp_memory *mem)
{
mem->pages = NULL;
mem->vmalloc_flag = false;
if (size <= 2*PAGE_SIZE)
mem->pages = kmalloc(size, GFP_KERNEL | __GFP_NORETRY);
- 確保したいメモリのサイズが 2ページ以下なら kmalloc() でメモリを確保する。
if (mem->pages == NULL) {
mem->pages = vmalloc(size);
mem->vmalloc_flag = true;
}
- kmalloc() が失敗するか、確保したいメモリのサイズが 2ページより大きければ
vmalloc() でメモリを確保する。
}
EXPORT_SYMBOL(agp_alloc_page_array);
- モジュールのライセンスに関係なくシンボルを公開する。
コメント†