函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

函数名称:z3fold_alloc() - allocates a region of a given size*@pool: z3fold pool from which to allocate*@size: size in bytes of the desired allocation*@gfp: gfp flags used if the pool needs to grow*@handle: handle of the new allocation* This function will attempt

函数原型:static int z3fold_alloc(struct z3fold_pool *pool, size_t size, gfp_t gfp, unsigned long *handle)

返回类型:int

参数:

类型参数名称
struct z3fold_pool *pool
size_tsize
gfp_tgfp
unsigned long *handle
1092  chunks等于Converts an allocation size in bytes to size in z3fold chunks
1093  struct z3fold_header * zhdr = NULL
1094  struct page * page = NULL
1096  can_sleep等于gfpflags_allow_blocking(gfp)
1098  如果非size则返回:负EINVAL
1101  如果size大于PAGE_SIZE则返回:负ENOSPC
1104  如果size大于PAGE_SIZEZHDR_SIZE_ALIGNEDCHUNK_SIZEbud等于HEADLESS
1106  否则
1107  retry :
1108  zhdr等于rns _locked_ z3fold page header or NULL
1109  如果zhdr
1110  如果first_chunks恒等于0则
1111  如果middle_chunks不等于0且chunks大于等于start_middlebud等于LAST
1114  否则bud等于FIRST
1116  否则如果last_chunks恒等于0则bud等于LAST
1118  否则如果middle_chunks恒等于0则bud等于MIDDLE
1120  否则
1131  转到:found
1133  bud等于FIRST
1136  page = NULL
1137  如果can_sleep
1138  加自旋锁
1139  zhdr等于list_first_entry_or_null - get the first element from a list*@ptr: the list head to take the element from.*@type: the type of the struct this is embedded in.*@member: the name of the list_head within the struct.( & stale, structz3fold_header, buddy)
1146  如果zhdr
1151  否则
1155  如果非pagepage等于alloc_page(gfp)
1158  如果非page则返回:负ENOMEM
1161  zhdr等于Initializes the z3fold header of a newly allocated z3fold page
1162  如果非zhdr
1163  __free_page(page)
1164  返回:负ENOMEM
1166  atomic64_inc( & pages_nr)
1168  如果bud恒等于HEADLESS
1169  设置内存位
1170  转到:headless
1172  如果can_sleep
1173  lock_page may only be called if we have the page's inode pinned.
1174  __SetPageMovable(page, i_mapping)
1175  lock_page - unlock a locked page*@page: the page* Unlocks the page and wakes up sleepers in ___wait_on_page_locked().* Also wakes sleepers in wait_on_page_writeback() because the wakeup* mechanism between PageLocked pages and PageWriteback pages is shared.
1176  否则
1182  Lock a z3fold page
1184  found :
1185  如果bud恒等于FIRSTfirst_chunks等于chunks
1187  否则如果bud恒等于LASTlast_chunks等于chunks
1189  否则
1190  middle_chunks等于chunks
1191  start_middle等于first_chunksZHDR_CHUNKS
1193  Add to the appropriate unbuddied list
1195  headless :
1196  加自旋锁
1198  如果非链表为空删除链表项
1201  添加链表项
1203  handle等于encode_handle(zhdr, bud)
1204  自旋锁解锁
1205  如果bud不等于HEADLESSUnlock a z3fold page
1208  返回:0
调用者
名称描述
z3fold_zpool_malloc