Giter Club home page Giter Club logo

linux-memavailable-procfs's Introduction

linux-memavailable-procfs

A Perl backport of the /proc/meminfo "MemAvailable" metric which got introduced in Linux 3.14 kernels.

Additionally, an improved "free" util is provided which replaces the traditional, outdated one.

You can read the Perl module documentation by executing "perldoc Linux-MemAvailable.pm" in a terminal. The "free.pl" executable has a standard documentation via "--help".

The original C source code in the kernel: https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=34e431b0ae398fc54ea69ff85ec700722c9da773

More info about the "MemAvailable" metric can be found in the kernel /proc filesystem docs: https://www.kernel.org/doc/Documentation/filesystems/proc.txt

Blog article with a few examples: http://blog.famzah.net/2014/09/24/memavailable-metric-for-linux-kernels-before-3-14-in-procmeminfo/

linux-memavailable-procfs's People

Contributors

famzah avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

linux-memavailable-procfs's Issues

clarification on "free w/o caches" and available memory

Hi,

fist of all, thank you for your blog and your perl tool. It's great to have it.

I'm also having several systems with large amount of sysv shmem, where classical "free" fails. What me puzzels is, that in free.pl you calculate:

my $minus_caches_data = {
        'used' => $mem_row_data->{'used'} - $mem_row_data->{'caches'},
        'free' => $mem_row_data->{'free'} + $mem_row_data->{'caches'},
};

of course your $mem_row_data->{'caches'} is far diffrent from classical "free", I wonder why you do not use 'free' => $avail from Linux::MemAvailable::calculate().

comparing free.pl's free+caches with Linux::MemAvailable::calculate()'s $avail ... there seems a (minor) difference (about 100MB sometimes).

In the meantime the procps tools (free, top, ...) have adopted. I've attached a screen shoot of them. Maybe your free.pl can match the new output (for older $enterprice distros that do not adopt so fast).
linux-3 14-mem-avail

Backport the new slightly different algorithm for "MemAvailable" used by Linux kernel 4.8+

On Ubuntu 16.04 (kernel 4.0.0.36) the "avail" value differs from system's by about 90M.

~/svn/psutil$ ./free.pl  | grep avail
  -/+ avail           7135660    9189988
~/svn/psutil$ cat /proc/meminfo |grep Avail
MemAvailable:    9091500 kB

At first I thought it was the Perl interpreter overhead but I tried running "cat /proc/meminfo |grep Avail" from the shell script as a subprocess and I get a similar result.
Any idea?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.