函数逻辑报告 |
Source Code:mm\percpu.c |
Create Date:2022-07-27 15:51:47 |
Last Modify:2022-05-23 13:52:24 | Copyright©Brick |
首页 | 函数Tree |
注解内核,赢得工具 | 下载SCCT | English |
函数名称:pcpu_alloc - the percpu allocator*@size: size of area to allocate in bytes*@align: alignment of area (max PAGE_SIZE)*@reserved: allocate from the reserved chunk if available*@gfp: allocation flags* Allocate percpu area of @size bytes aligned at @align
函数原型:static void __percpu *pcpu_alloc(size_t size, size_t align, bool reserved, gfp_t gfp)
返回类型:void
参数:
类型 | 参数 | 名称 |
---|---|---|
size_t | size | |
size_t | align | |
bool | reserved | |
gfp_t | gfp |
1591 | is_atomic等于gfp按位与GFP_KERNEL的值不等于GFP_KERNEL |
1593 | warn_limit等于10 |
1618 | 返回:NULL |
1621 | 如果非is_atomic则 |
1627 | 如果gfp按位与__GFP_NOFAIL则mutex_lock( & pcpu_alloc_mutex) |
1629 | 否则如果mutex_lock_killable( & pcpu_alloc_mutex)则返回:NULL |
1633 | spin_lock_irqsave( & pcpu_lock, flags) |
1637 | chunk等于Optional reserved chunk. This chunk reserves part of the first* chunk and serves it for reserved allocations. When the reserved* region doesn't exist, the following variable is NULL. |
1640 | 如果off小于0则 |
1641 | err等于"alloc from reserved chunk failed" |
1642 | 转到:fail_unlock |
1646 | 如果off大于等于0则转到:area_found |
1649 | err等于"alloc from reserved chunk failed" |
1650 | 转到:fail_unlock |
1653 | restart : |
1655 | 以slot小于pcpu_nr_slots循环 |
1659 | 如果off小于0则 |
1660 | 如果slot小于chunks in slots below this are subject to being sidelined on failed alloc 则pcpu_chunk_move(chunk, 0) |
1662 | 继续下一循环 |
1666 | 如果off大于等于0则转到:area_found |
1672 | spin_unlock_irqrestore( & pcpu_lock, flags) |
1679 | 如果is_atomic则 |
1684 | 如果链表为空则 |
1693 | 否则 |
1694 | spin_lock_irqsave( & pcpu_lock, flags) |
1697 | 转到:restart |
1699 | area_found : |
1700 | pcpu_stats_area_alloc(chunk, size) |
1701 | spin_unlock_irqrestore( & pcpu_lock, flags) |
1704 | 如果非is_atomic则 |
1707 | page_start等于PFN_DOWN(off) |
1712 | WARN_ON( no [de]population allowed ) |
1716 | spin_lock_irqsave( & pcpu_lock, flags) |
1717 | 如果ret则 |
1719 | err等于"failed to populate" |
1720 | 转到:fail_unlock |
1723 | spin_unlock_irqrestore( & pcpu_lock, flags) |
1729 | 如果The number of empty populated pages, protected by pcpu_lock. The* reserved chunk doesn't contribute to the count.小于PCPU_EMPTY_POP_PAGES_LOW则pcpu_schedule_balance_work() |
1737 | kmemleak_alloc_percpu(ptr, size, gfp) |
1739 | trace_percpu_alloc_percpu(reserved, is_atomic, size, align, base address of this chunk , off, ptr) |
1742 | 返回:ptr |
1744 | fail_unlock : |
1745 | spin_unlock_irqrestore( & pcpu_lock, flags) |
1746 | fail : |
1749 | 如果非is_atomic且do_warn且warn_limit则 |
1752 | dump_stack() |
1753 | 如果非warn_limit先自减则打印信息("limit reached, disable warning\n") |
1756 | 如果is_atomic则 |
1758 | pcpu_atomic_alloc_failed = true |
1759 | pcpu_schedule_balance_work() |
1760 | 否则 |
1763 | 返回:NULL |
名称 | 描述 |
---|---|
__alloc_percpu_gfp | __alloc_percpu_gfp - allocate dynamic percpu area*@size: size of area to allocate in bytes*@align: alignment of area (max PAGE_SIZE)*@gfp: allocation flags* Allocate zero-filled percpu area of @size bytes aligned at @align |
__alloc_percpu | __alloc_percpu - allocate dynamic percpu area*@size: size of area to allocate in bytes*@align: alignment of area (max PAGE_SIZE)* Equivalent to __alloc_percpu_gfp(size, align, %GFP_KERNEL). |
__alloc_reserved_percpu | __alloc_reserved_percpu - allocate reserved percpu area*@size: size of area to allocate in bytes*@align: alignment of area (max PAGE_SIZE)* Allocate zero-filled percpu area of @size bytes aligned at @align* from reserved percpu area if arch has set it up; |
源代码转换工具 开放的插件接口 | X |
---|---|
支持:c/c++/esqlc/java Oracle/Informix/Mysql 插件可实现:逻辑报告 代码生成和批量转换代码 |