函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:mm\zsmalloc.c Create Date:2022-07-27 18:02:34
Last Modify:2020-03-12 14:18:49 Copyright©Brick
首页 函数Tree
注解内核,赢得工具下载SCCTEnglish

函数名称:obj_malloc

函数原型:static unsigned long obj_malloc(struct size_class *class, struct zspage *zspage, unsigned long handle)

返回类型:unsigned long

参数:

类型参数名称
struct size_class *class
struct zspage *zspage
unsigned longhandle
1418  handle或等于Head in allocated object should have OBJ_ALLOCATED_TAG* to identify the object was allocated or not.* It's okay to add the status bit in the least bit because* header keeps handle which is 4byte-aligned address so we* have room for two bit at least.
1419  obj等于get_freeobj(zspage)
1421  offset等于obj* Size of objects stored in this class. Must be multiple * of ZS_ALIGN.
1422  nr_page等于offset右移PAGE_SHIFT determines the page size
1423  m_offset等于offset按位与PAGE_MASK的反
1424  m_page等于get_first_page(zspage)
1426 i小于nr_page循环m_page等于get_next_page(m_page)
1429  vaddr等于kmap_atomic(m_page)
1430  link等于vaddrm_offsetlink的长度
1431  set_freeobj(zspage, Free object index;* It's valid for non-allocated object >> OBJ_TAG_BITS)
1432  如果此条件成立可能性大(为编译器优化)(!PageHugeObject(m_page))则Handle of allocated object.等于handle
1435  否则 Our offset within mapping. 等于handle
1439  Prevent people trying to call kunmap_atomic() as if it were kunmap()* kunmap_atomic() should get the return value of kmap_atomic, not the page.(vaddr)
1440  mod_zspage_inuse(zspage, 1)
1441  ype can be of enum type zs_stat_type or fullness_group
1443  obj等于location_to_obj - get obj value encoded from (, )*@page: page object resides in zspage*@obj_idx: object index
1445  返回:obj
调用者
名称描述
zs_malloczs_malloc - Allocate block of given size from pool.*@pool: pool to allocate from*@size: size of block to allocate*@gfp: gfp flags when allocating object* On success, handle to the allocated object is returned,* otherwise 0.
migrate_zspage