zsmalloc.c (010b495e2fa32353d0ef6aa70a8169e5ef617a15) | zsmalloc.c (e8b098fc5747a7c871f113c9eb65453cc2d86e6f) |
---|---|
1/* 2 * zsmalloc memory allocator 3 * 4 * Copyright (C) 2011 Nitin Gupta 5 * Copyright (C) 2012, 2013 Minchan Kim 6 * 7 * This code is released using a dual license strategy: BSD/GPL 8 * You can choose the license that better fits your requirements. --- 837 unchanged lines hidden (view full) --- 846 if (unlikely(PageHugeObject(page))) 847 return NULL; 848 849 return page->freelist; 850} 851 852/** 853 * obj_to_location - get (<page>, <obj_idx>) from encoded object value | 1/* 2 * zsmalloc memory allocator 3 * 4 * Copyright (C) 2011 Nitin Gupta 5 * Copyright (C) 2012, 2013 Minchan Kim 6 * 7 * This code is released using a dual license strategy: BSD/GPL 8 * You can choose the license that better fits your requirements. --- 837 unchanged lines hidden (view full) --- 846 if (unlikely(PageHugeObject(page))) 847 return NULL; 848 849 return page->freelist; 850} 851 852/** 853 * obj_to_location - get (<page>, <obj_idx>) from encoded object value |
854 * @obj: the encoded object value |
|
854 * @page: page object resides in zspage 855 * @obj_idx: object index 856 */ 857static void obj_to_location(unsigned long obj, struct page **page, 858 unsigned int *obj_idx) 859{ 860 obj >>= OBJ_TAG_BITS; 861 *page = pfn_to_page(obj >> OBJ_INDEX_BITS); --- 434 unchanged lines hidden (view full) --- 1296 return atomic_long_read(&pool->pages_allocated); 1297} 1298EXPORT_SYMBOL_GPL(zs_get_total_pages); 1299 1300/** 1301 * zs_map_object - get address of allocated object from handle. 1302 * @pool: pool from which the object was allocated 1303 * @handle: handle returned from zs_malloc | 855 * @page: page object resides in zspage 856 * @obj_idx: object index 857 */ 858static void obj_to_location(unsigned long obj, struct page **page, 859 unsigned int *obj_idx) 860{ 861 obj >>= OBJ_TAG_BITS; 862 *page = pfn_to_page(obj >> OBJ_INDEX_BITS); --- 434 unchanged lines hidden (view full) --- 1297 return atomic_long_read(&pool->pages_allocated); 1298} 1299EXPORT_SYMBOL_GPL(zs_get_total_pages); 1300 1301/** 1302 * zs_map_object - get address of allocated object from handle. 1303 * @pool: pool from which the object was allocated 1304 * @handle: handle returned from zs_malloc |
1305 * @mm: maping mode to use |
|
1304 * 1305 * Before using an object allocated from zs_malloc, it must be mapped using 1306 * this function. When done with the object, it must be unmapped using 1307 * zs_unmap_object. 1308 * 1309 * Only one object can be mapped per cpu at a time. There is no protection 1310 * against nested mappings. 1311 * --- 1226 unchanged lines hidden --- | 1306 * 1307 * Before using an object allocated from zs_malloc, it must be mapped using 1308 * this function. When done with the object, it must be unmapped using 1309 * zs_unmap_object. 1310 * 1311 * Only one object can be mapped per cpu at a time. There is no protection 1312 * against nested mappings. 1313 * --- 1226 unchanged lines hidden --- |