There Are Not Enough Slots Available In The System To Satisfy The Rating: 4,9/5 3884 reviews

The last aspect of the VM we are going to discuss is the Out Of Memory (OOM)manager. This intentionally is a very short chapter as it has one simple task;check if there is enough available memory to satisfy, verify that the systemis truely out of memory and if so, select a process to kill. This is acontroversial part of the VM and it has been suggested that it be removed onmany occasions. Regardless of whether it exists in the latest kernel, it stillis a useful system to examine as it touches off a number of other subsystems.

13.1 Checking Available Memory

Mpiexec -np 4 python main.pympiexec运行报错:There are not enough slots available in the system to satisfy the 4 slots Either request fewer slot解决办法:mpiexec -oversubscribe -np 4 python main.py. There are not enough slots available in the system to satisfy the 32 slots that were requested by the application: ABYSS-P Either request fewer slots for your application, or make more slots available for use. Adding -oversubscribe works around the issue.

For certain operations, such as expaning the heap with brk() orremapping an address space with mremap(), the system will checkif there is enough available memory to satisfy a request. Note that thisis separate to the out_of_memory() path that is covered in thenext section. This path is used to avoid the system being in a state of OOMif at all possible.

When checking available memory, the number of required pages is passedas a parameter to vm_enough_memory(). Unless the systemadministrator has specified that the system should overcommit memory, themount of available memory will be checked. To determine how many pages arepotentially available, Linux sums up the following bits of data:

Total page cache as page cache is easily reclaimed
Total free pages because they are already available
Total free swap pages as userspace pages may be paged out
Total pages managed by swapper_space although thisdouble-counts the free swap pages. This is balanced by the fact that slots aresometimes reserved but not used
Total pages used by the dentry cache as they are easily reclaimed
Total pages used by the inode cache as they are easily reclaimed

If the total number of pages added here is sufficient for the request,vm_enough_memory() returns true to the caller. If false is returned,the caller knows that the memory is not available and usually decides to return-ENOMEM to userspace.

13.2 Determining OOM Status

When the machine is low on memory, old page frames will be reclaimed (seeChapter 10) but despite reclaimingpages is may find that it was unable to free enough pages to satisfy a requesteven when scanning at highest priority. If it does fail to free page frames,out_of_memory() is called to see if the system is out of memoryand needs to kill a process.

There are not enough slots available in the system to satisfy the following

There Are Not Enough Slots Available In The System To Satisfy The Following

Unfortunately, it is possible that the system is not out memory andsimply needs to wait for IO to complete or for pages to be swapped tobacking storage. This is unfortunate, not because the system has memory,but because the function is being called unnecessarily opening the possiblyof processes being unnecessarily killed. Before deciding to kill a process,it goes through the following checklist.

  • Is there enough swap space left (nr_swap_pages > 0) ? If yes, not OOM
  • Has it been more than 5 seconds since the last failure? If yes, not OOM
  • Have we failed within the last second? If no, not OOM
  • If there hasn't been 10 failures at least in the last 5 seconds, we're not OOM
  • Has a process been killed within the last 5 seconds? If yes, not OOM

It is only if the above tests are passed that oom_kill()is called to select a process to kill.

13.3 Selecting a Process

The function select_bad_process() is responsible forchoosing a process to kill. It decides by stepping through each runningtask and calculating how suitable it is for killing with the functionbadness(). The badness is calculated as follows, note that thesquare roots are integer approximations calculated with int_sqrt();

This has been chosen to select a process that is using a large amountof memory but is not that long lived. Processes which have been runninga long time are unlikely to be the cause of memory shortage so thiscalculation is likely to select a process that uses a lot of memorybut has not been running long. If the process is a root process or hasCAP_SYS_ADMIN capabilities, the points are divided by fouras it is assumed that root privilege processes are well behaved. Similarly,if it has CAP_SYS_RAWIO capabilities (access to raw devices)privileges, the points are further divided by 4 as it is undesirable to killa process that has direct access to hardware.

13.4 Killing the Selected Process

Once a task is selected, the list is walked again and each process that sharesthe same mm_struct as the selected process (i.e. they arethreads) is sent a signal. If the process has CAP_SYS_RAWIOcapabilities, a SIGTERM is sent to give the process a chanceof exiting cleanly, otherwise a SIGKILL is sent.

13.5 Is That It?

There Are Not Enough Slots Available In The System To Satisfy The Current

Yes, thats it, out of memory management touches a lot of subsystems otherwise,there is not much to it.

13.6 What's New in 2.6

The majority of OOM management remains essentially the same for 2.6 except forthe introduction of VM accounted objects. These are VMAs that are flagged withthe VM_ACCOUNT flag, first mentioned in Section 4.8. Additional checks will be made to ensurethere is memory available when performing operations on VMAs with thisflag set. The principal incentive for this complexity is to avoid the needof an OOM killer.

Some regions which always have the VM_ACCOUNT flag setare the process stack, the process heap, regions mmap()ed withMAP_SHARED, private regions that are writable and regionsset up shmget(). In other words, most userspace mappings have theVM_ACCOUNT flag set.

There Are Not Enough Slots Available In The System To Satisfy The 10 Slots

Linux accounts for the amount of memory that is committed to these VMAswith vm_acct_memory() which increments a variable calledcommitted_space. When the VMA is freed, the committed space isdecremented with vm_unacct_memory(). This is a fairly simplemechanism, but it allows Linux to remember how much memory it has alreadycommitted to userspace when deciding if it should commit more.

The checks are performed by calling security_vm_enough_memory()which introduces us to another new feature. 2.6 has a featureavailable which allows security related kernel modules to overridecertain kernel functions. The full list of hooks available is storedin a structsecurity_operations calledsecurity_ops. There are a number of dummy, or default, functionsthat may be used which are all listed in security/dummy.c butthe majority do nothing except return. If there are no security modulesloaded, the security_operations struct used is calleddummy_security_ops which uses all the default function.

By default, security_vm_enough_memory() callsdummy_vm_enough_memory() which is declaredin security/dummy.c and is very similar to 2.4'svm_enough_memory() function. The new version adds the followingpieces of information together to determine available memory:

Total page cache as page cache is easily reclaimed
Total free pages because they are already available
Total free swap pages as userspace pages may be paged out
Slab pages with SLAB_RECLAIM_ACCOUNT set as they areeasily reclaimed

There Are Not Enough Slots Available In The System To Satisfy The Customer

These pages, minus a 3% reserve for root processes, is the total amountof memory that is available for the request. If the memory is available,it makes a check to ensure the total amount of committed memory does notexceed the allowed threshold. The allowed threshold is TotalRam *(OverCommitRatio/100) + TotalSwapPage, where OverCommitRatiois set by the system administrator. If the total amount of committed space isnot too high, 1 will be returned so that the allocation can proceed.

Coments are closed
© 2022 - quecasistisidi.netlify.com
Scroll to top