Function report |
Source Code:mm\util.c |
Create Date:2022-07-28 14:22:09 |
| Last Modify:2020-03-12 14:18:49 | Copyright©Brick |
| home page | Tree |
| Annotation kernel can get tool activity | Download SCCT | Chinese |
Name: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
Proto:int __vm_enough_memory(struct mm_struct *mm, long pages, int cap_sys_admin)
Type:int
Parameter:
| Type | Parameter | Name |
|---|---|---|
| struct mm_struct * | mm | |
| long | pages | |
| int | cap_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 | If sysctl_overcommit_memory == OVERCOMMIT_ALWAYS Then Return 0 |
| 813 | If sysctl_overcommit_memory == OVERCOMMIT_GUESS Then |
| 814 | If pages > totalram_pages() + total_swap_pages Then Go to error |
| 816 | Return 0 |
| 823 | If Not cap_sys_admin Then allowed -= sysctl_admin_reserve_kbytes >> PAGE_SHIFT determines the page size - 10 |
| 829 | If mm Then |
| 835 | If percpu_counter is intended to track positive numbers. In the UP case the* number should never be negative. < allowed Then Return 0 |
| 837 | error : |
| 838 | vm_unacct_memory(pages) |
| 840 | Return -ENOMEM |
| Source code conversion tool public plug-in interface | X |
|---|---|
| Support c/c++/esqlc/java Oracle/Informix/Mysql Plug-in can realize: logical Report Code generation and batch code conversion |