函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

函数名称:Check that a process has enough memory to allocate a new virtual* mapping. 0 means there is enough memory for the allocation to* succeed and -ENOMEM implies there is not.* We currently support three overcommit policies, which are set via the* vm

函数原型:int __vm_enough_memory(struct mm_struct *mm, long pages, int cap_sys_admin)

返回类型:int

参数:

类型参数名称
struct mm_struct *mm
longpages
intcap_sys_admin
801  VM_WARN_ONCE(percpu_counter_read( & Make sure vm_committed_as in one cacheline and not cacheline shared with* other variables. It can be updated by several CPUs frequently.) < - (s64)vm_committed_as_batch * num_online_cpus(), "memory commitment underflow")
805  vm_acct_memory(pages)
810  如果sysctl_overcommit_memory恒等于OVERCOMMIT_ALWAYS则返回:0
813  如果sysctl_overcommit_memory恒等于OVERCOMMIT_GUESS
814  如果pages大于totalram_pages()加total_swap_pages则转到:error
816  返回:0
819  allowed等于Committed memory limit enforced when OVERCOMMIT_NEVER policy is used
823  如果非cap_sys_adminallowed减等于sysctl_admin_reserve_kbytes右移PAGE_SHIFT determines the page size 减10位
829  如果mm
830  reserve等于sysctl_user_reserve_kbytes右移PAGE_SHIFT determines the page size 减10位
832  allowed减等于min_t - return minimum of two values, using the specified type*@type: data type to use*@x: first value*@y: second value(long, Total pages mapped / 32, reserve)
835  如果percpu_counter is intended to track positive numbers. In the UP case the* number should never be negative.小于allowed则返回:0
837  error :
838  vm_unacct_memory(pages)
840  返回:负ENOMEM
调用者
名称描述
security_vm_enough_memory_mm