Lines Matching refs:handle
248 unsigned long handle; member
357 static void cache_free_handle(struct zs_pool *pool, unsigned long handle) in cache_free_handle() argument
359 kmem_cache_free(pool->handle_cachep, (void *)handle); in cache_free_handle()
373 static void record_obj(unsigned long handle, unsigned long obj) in record_obj() argument
380 WRITE_ONCE(*(unsigned long *)handle, obj); in record_obj()
405 unsigned long *handle) in zs_zpool_malloc() argument
407 *handle = zs_malloc(pool, size, gfp); in zs_zpool_malloc()
408 return *handle ? 0 : -1; in zs_zpool_malloc()
410 static void zs_zpool_free(void *pool, unsigned long handle) in zs_zpool_free() argument
412 zs_free(pool, handle); in zs_zpool_free()
415 static void *zs_zpool_map(void *pool, unsigned long handle, in zs_zpool_map() argument
433 return zs_map_object(pool, handle, zs_mm); in zs_zpool_map()
435 static void zs_zpool_unmap(void *pool, unsigned long handle) in zs_zpool_unmap() argument
437 zs_unmap_object(pool, handle); in zs_zpool_unmap()
870 static unsigned long handle_to_obj(unsigned long handle) in handle_to_obj() argument
872 return *(unsigned long *)handle; in handle_to_obj()
884 static inline int testpin_tag(unsigned long handle) in testpin_tag() argument
886 return bit_spin_is_locked(HANDLE_PIN_BIT, (unsigned long *)handle); in testpin_tag()
889 static inline int trypin_tag(unsigned long handle) in trypin_tag() argument
891 return bit_spin_trylock(HANDLE_PIN_BIT, (unsigned long *)handle); in trypin_tag()
894 static void pin_tag(unsigned long handle) in pin_tag() argument
896 bit_spin_lock(HANDLE_PIN_BIT, (unsigned long *)handle); in pin_tag()
899 static void unpin_tag(unsigned long handle) in unpin_tag() argument
901 bit_spin_unlock(HANDLE_PIN_BIT, (unsigned long *)handle); in unpin_tag()
1291 void *zs_map_object(struct zs_pool *pool, unsigned long handle, in zs_map_object() argument
1314 pin_tag(handle); in zs_map_object()
1316 obj = handle_to_obj(handle); in zs_map_object()
1350 void zs_unmap_object(struct zs_pool *pool, unsigned long handle) in zs_unmap_object() argument
1362 obj = handle_to_obj(handle); in zs_unmap_object()
1384 unpin_tag(handle); in zs_unmap_object()
1408 struct zspage *zspage, unsigned long handle) in obj_malloc() argument
1418 handle |= OBJ_ALLOCATED_TAG; in obj_malloc()
1434 link->handle = handle; in obj_malloc()
1437 zspage->first_page->index = handle; in obj_malloc()
1461 unsigned long handle, obj; in zs_malloc() local
1469 handle = cache_alloc_handle(pool, gfp); in zs_malloc()
1470 if (!handle) in zs_malloc()
1480 obj = obj_malloc(class, zspage, handle); in zs_malloc()
1483 record_obj(handle, obj); in zs_malloc()
1486 return handle; in zs_malloc()
1493 cache_free_handle(pool, handle); in zs_malloc()
1498 obj = obj_malloc(class, zspage, handle); in zs_malloc()
1502 record_obj(handle, obj); in zs_malloc()
1511 return handle; in zs_malloc()
1540 void zs_free(struct zs_pool *pool, unsigned long handle) in zs_free() argument
1551 if (unlikely(!handle)) in zs_free()
1554 pin_tag(handle); in zs_free()
1555 obj = handle_to_obj(handle); in zs_free()
1580 unpin_tag(handle); in zs_free()
1581 cache_free_handle(pool, handle); in zs_free()
1658 unsigned long handle = 0; in find_alloced_obj() local
1667 handle = head & ~OBJ_ALLOCATED_TAG; in find_alloced_obj()
1668 if (trypin_tag(handle)) in find_alloced_obj()
1670 handle = 0; in find_alloced_obj()
1681 return handle; in find_alloced_obj()
1699 unsigned long handle; in migrate_zspage() local
1706 handle = find_alloced_obj(class, s_page, &obj_idx); in migrate_zspage()
1707 if (!handle) { in migrate_zspage()
1717 unpin_tag(handle); in migrate_zspage()
1722 used_obj = handle_to_obj(handle); in migrate_zspage()
1723 free_obj = obj_malloc(class, get_zspage(d_page), handle); in migrate_zspage()
1733 record_obj(handle, free_obj); in migrate_zspage()
1734 unpin_tag(handle); in migrate_zspage()
1982 unsigned long handle, head; in zs_page_migrate() local
2021 handle = head & ~OBJ_ALLOCATED_TAG; in zs_page_migrate()
2022 if (!trypin_tag(handle)) in zs_page_migrate()
2039 handle = head & ~OBJ_ALLOCATED_TAG; in zs_page_migrate()
2040 if (!testpin_tag(handle)) in zs_page_migrate()
2043 old_obj = handle_to_obj(handle); in zs_page_migrate()
2048 record_obj(handle, new_obj); in zs_page_migrate()
2087 handle = head & ~OBJ_ALLOCATED_TAG; in zs_page_migrate()
2088 if (!testpin_tag(handle)) in zs_page_migrate()
2090 unpin_tag(handle); in zs_page_migrate()