Lines Matching refs:pool
283 static int create_handle_cache(struct zs_pool *pool) in create_handle_cache() argument
285 pool->handle_cachep = kmem_cache_create("zs_handle", ZS_HANDLE_SIZE, in create_handle_cache()
287 return pool->handle_cachep ? 0 : 1; in create_handle_cache()
290 static void destroy_handle_cache(struct zs_pool *pool) in destroy_handle_cache() argument
292 if (pool->handle_cachep) in destroy_handle_cache()
293 kmem_cache_destroy(pool->handle_cachep); in destroy_handle_cache()
296 static unsigned long alloc_handle(struct zs_pool *pool) in alloc_handle() argument
298 return (unsigned long)kmem_cache_alloc(pool->handle_cachep, in alloc_handle()
299 pool->flags & ~__GFP_HIGHMEM); in alloc_handle()
302 static void free_handle(struct zs_pool *pool, unsigned long handle) in free_handle() argument
304 kmem_cache_free(pool->handle_cachep, (void *)handle); in free_handle()
326 static void zs_zpool_destroy(void *pool) in zs_zpool_destroy() argument
328 zs_destroy_pool(pool); in zs_zpool_destroy()
331 static int zs_zpool_malloc(void *pool, size_t size, gfp_t gfp, in zs_zpool_malloc() argument
334 *handle = zs_malloc(pool, size); in zs_zpool_malloc()
337 static void zs_zpool_free(void *pool, unsigned long handle) in zs_zpool_free() argument
339 zs_free(pool, handle); in zs_zpool_free()
342 static int zs_zpool_shrink(void *pool, unsigned int pages, in zs_zpool_shrink() argument
348 static void *zs_zpool_map(void *pool, unsigned long handle, in zs_zpool_map() argument
366 return zs_map_object(pool, handle, zs_mm); in zs_zpool_map()
368 static void zs_zpool_unmap(void *pool, unsigned long handle) in zs_zpool_unmap() argument
370 zs_unmap_object(pool, handle); in zs_zpool_unmap()
373 static u64 zs_zpool_total_size(void *pool) in zs_zpool_total_size() argument
375 return zs_get_total_pages(pool) << PAGE_SHIFT; in zs_zpool_total_size()
492 struct zs_pool *pool = s->private; in zs_stats_size_show() local
506 class = pool->size_class[i]; in zs_stats_size_show()
556 static int zs_pool_stat_create(char *name, struct zs_pool *pool) in zs_pool_stat_create() argument
568 pool->stat_dentry = entry; in zs_pool_stat_create()
571 pool->stat_dentry, pool, &zs_stat_size_ops); in zs_pool_stat_create()
581 static void zs_pool_stat_destroy(struct zs_pool *pool) in zs_pool_stat_destroy() argument
583 debugfs_remove_recursive(pool->stat_dentry); in zs_pool_stat_destroy()
613 static inline int zs_pool_stat_create(char *name, struct zs_pool *pool) in zs_pool_stat_create() argument
618 static inline void zs_pool_stat_destroy(struct zs_pool *pool) in zs_pool_stat_destroy() argument
1241 unsigned long zs_get_total_pages(struct zs_pool *pool) in zs_get_total_pages() argument
1243 return atomic_long_read(&pool->pages_allocated); in zs_get_total_pages()
1261 void *zs_map_object(struct zs_pool *pool, unsigned long handle, in zs_map_object() argument
1289 class = pool->size_class[class_idx]; in zs_map_object()
1315 void zs_unmap_object(struct zs_pool *pool, unsigned long handle) in zs_unmap_object() argument
1330 class = pool->size_class[class_idx]; in zs_unmap_object()
1391 unsigned long zs_malloc(struct zs_pool *pool, size_t size) in zs_malloc() argument
1400 handle = alloc_handle(pool); in zs_malloc()
1406 class = pool->size_class[get_size_class_index(size)]; in zs_malloc()
1413 first_page = alloc_zspage(class, pool->flags); in zs_malloc()
1415 free_handle(pool, handle); in zs_malloc()
1421 &pool->pages_allocated); in zs_malloc()
1438 static void obj_free(struct zs_pool *pool, struct size_class *class, in obj_free() argument
1470 void zs_free(struct zs_pool *pool, unsigned long handle) in zs_free() argument
1487 class = pool->size_class[class_idx]; in zs_free()
1490 obj_free(pool, class, obj); in zs_free()
1496 &pool->pages_allocated); in zs_free()
1502 free_handle(pool, handle); in zs_free()
1617 static int migrate_zspage(struct zs_pool *pool, struct size_class *class, in migrate_zspage() argument
1658 obj_free(pool, class, used_obj); in migrate_zspage()
1686 static void putback_zspage(struct zs_pool *pool, struct size_class *class, in putback_zspage() argument
1701 &pool->pages_allocated); in putback_zspage()
1718 static unsigned long __zs_compact(struct zs_pool *pool, in __zs_compact() argument
1743 if (!migrate_zspage(pool, class, &cc)) in __zs_compact()
1746 putback_zspage(pool, class, dst_page); in __zs_compact()
1755 putback_zspage(pool, class, dst_page); in __zs_compact()
1756 putback_zspage(pool, class, src_page); in __zs_compact()
1764 putback_zspage(pool, class, src_page); in __zs_compact()
1771 unsigned long zs_compact(struct zs_pool *pool) in zs_compact() argument
1778 class = pool->size_class[i]; in zs_compact()
1783 nr_migrated += __zs_compact(pool, class); in zs_compact()
1803 struct zs_pool *pool; in zs_create_pool() local
1806 pool = kzalloc(sizeof(*pool), GFP_KERNEL); in zs_create_pool()
1807 if (!pool) in zs_create_pool()
1810 pool->size_class = kcalloc(zs_size_classes, sizeof(struct size_class *), in zs_create_pool()
1812 if (!pool->size_class) { in zs_create_pool()
1813 kfree(pool); in zs_create_pool()
1817 pool->name = kstrdup(name, GFP_KERNEL); in zs_create_pool()
1818 if (!pool->name) in zs_create_pool()
1821 if (create_handle_cache(pool)) in zs_create_pool()
1849 pool->size_class[i] = prev_class; in zs_create_pool()
1865 pool->size_class[i] = class; in zs_create_pool()
1870 pool->flags = flags; in zs_create_pool()
1872 if (zs_pool_stat_create(name, pool)) in zs_create_pool()
1875 return pool; in zs_create_pool()
1878 zs_destroy_pool(pool); in zs_create_pool()
1883 void zs_destroy_pool(struct zs_pool *pool) in zs_destroy_pool() argument
1887 zs_pool_stat_destroy(pool); in zs_destroy_pool()
1891 struct size_class *class = pool->size_class[i]; in zs_destroy_pool()
1908 destroy_handle_cache(pool); in zs_destroy_pool()
1909 kfree(pool->size_class); in zs_destroy_pool()
1910 kfree(pool->name); in zs_destroy_pool()
1911 kfree(pool); in zs_destroy_pool()