mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-28 10:41:38 -04:00
[PATCH] mempool: add page allocator
This will be used by the next patch in the series to replace duplicate mempool-backed page allocators in 2 places in the kernel. It is also likely that there will be more users in the future. Signed-off-by: Matthew Dobson <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
This commit is contained in:
parent
8219dd5710
commit
6e0678f394
2 changed files with 30 additions and 0 deletions
18
mm/mempool.c
18
mm/mempool.c
|
|
@ -289,3 +289,21 @@ void mempool_free_slab(void *element, void *pool_data)
|
|||
kmem_cache_free(mem, element);
|
||||
}
|
||||
EXPORT_SYMBOL(mempool_free_slab);
|
||||
|
||||
/*
|
||||
* A simple mempool-backed page allocator that allocates pages
|
||||
* of the order specified by pool_data.
|
||||
*/
|
||||
void *mempool_alloc_pages(gfp_t gfp_mask, void *pool_data)
|
||||
{
|
||||
int order = (int)(long)pool_data;
|
||||
return alloc_pages(gfp_mask, order);
|
||||
}
|
||||
EXPORT_SYMBOL(mempool_alloc_pages);
|
||||
|
||||
void mempool_free_pages(void *element, void *pool_data)
|
||||
{
|
||||
int order = (int)(long)pool_data;
|
||||
__free_pages(element, order);
|
||||
}
|
||||
EXPORT_SYMBOL(mempool_free_pages);
|
||||
|
|
|
|||
Loading…
Reference in a new issue