函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

函数名称:zbud_alloc() - allocates a region of a given size*@pool: zbud 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 to

函数原型:int zbud_alloc(struct zbud_pool *pool, size_t size, gfp_t gfp, unsigned long *handle)

返回类型:int

参数:

类型参数名称
struct zbud_pool *pool
size_tsize
gfp_tgfp
unsigned long *handle
358  struct zbud_header * zhdr = NULL
362  如果非sizegfp按位与__GFP_HIGHMEM则返回:负EINVAL
364  如果size大于PAGE_SIZEZHDR_SIZE_ALIGNEDCHUNK_SIZE则返回:负ENOSPC
366  chunks等于Converts an allocation size in bytes to size in zbud chunks
367  加自旋锁
370  zhdr = NULL
372  如果非链表为空
373  zhdr等于list_first_entry - 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.* Note, that list is expected to be not empty.( & unbuddied[i], structzbud_header, buddy)
375  删除链表项
376  如果first_chunks恒等于0则bud等于FIRST
378  否则bud等于LAST
380  转到:found
385  自旋锁解锁
386  page等于alloc_page(gfp)
387  如果非page则返回:负ENOMEM
389  加自旋锁
390  pages_nr自加
391  zhdr等于Initializes the zbud header of a newly allocated zbud page
392  bud等于FIRST
394  found :
395  如果bud恒等于FIRSTfirst_chunks等于chunks
397  否则last_chunks等于chunks
400  如果first_chunks恒等于0或last_chunks恒等于0则
402  freechunks等于Returns the number of free chunks in a zbud page
403  添加链表项
404  否则
406  添加链表项
410  如果非链表为空删除链表项
412  添加链表项
414  handle等于Encodes the handle of a particular buddy within a zbud page* Pool lock should be held as this function accesses first|last_chunks
415  自旋锁解锁
417  返回:0
调用者
名称描述
zbud_zpool_malloc