sbloglooki.blogg.se

Linux see free memory
Linux see free memory






linux see free memory

The next obvious question is: okay, so I need to look at available memory, do I need to monitor for a certain amount, such as a percentage of total memory? Despite being an obvious question, this cannot be answered without understanding the system and especially the processing application on it.

linux see free memory

A free page has all that work done upfront, and can just be taken from the list. The main reason for doing that is performance: if a page is required by a process, and it would need to find an available page, the requesting process must stop processing and scan memory for pages that are available, which takes time and CPU processing, and if a page is found, it needs to be freed (removed from the lists in which it could be found to be used for the original contents). So, if you want to know how much memory can be used on a linux system, available memory is the statistic to look for, and not free memory.Īn obvious question at this point is: if there is available memory that actually should be looked for when trying to assess memory health, which is traditionally done by looking at free memory, why is there free memory, and not just available memory?įree memory is really just a minimal amount of pages made free upfront to quickly provide the kernel or a process with some free pages, for the maximal amount as set by the kernel parameter vm.min_free_kbytes. This is the amount of memory that could be used if memory is needed by any process. So what is that indicator? Since this commit there is the notion of 'available memory' (unsurprisingly, 'MemAvailable' in /proc/meminfo). I just said that free memory is not that indicator. However, there must be some sort of indicator that tells you how much memory the operating system can use. In linux, there are no settings for dedicating a memory area as disk cache, instead it essentially takes all non-used memory and keeps the data in it available as long as there isn't another, better purpose for the page. In fact, radically cleaning all used pages after use would eliminate the (disk) page cache in linux. It doesn't make sense to free all used memory right after usage, such as a page read from disk. One of the many optimizations in linux is to use memory for a purpose, such as storing an earlier read page from disk. The linux operating system frees a low amount of memory, for the reason to make use of memory as optimal as it can.

linux see free memory

A free page is produced by the kernel page daemon (commonly named 'swapper'), or by a process that explicitly frees memory. Of course free memory is directly available, actually free memory, which can be directly used by a process that needs free memory (a free page). On linux, this is not the same as free memory. What this quote means to say is that whilst the free memory statistic obviously shows free memory, what you are actually looking for is the amount of memory that can be used for memory allocations on the system. To start off, a reference to a starwars quote: 'This is not the free memory you're looking for'. This blogpost is about linux memory management, and specifically about the question that has been asked about probably any operating system throughout history: how much free memory do I need to consider it to be healthy?








Linux see free memory