Ad Widget

Collapse

REAL free memory under FreeBSD!

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Mox
    Member
    • Sep 2009
    • 90

    #1

    REAL free memory under FreeBSD!

    I just want to say:
    Please, add some new modes for vm.memory.size key and delete useless modes!

    It need for FreeBSD and maybe other BSD systems. If you want I'll check it!
    Memory organization in FreeBSD is different than Linux.
    Existing modes like 'used', 'shared', 'pfree' and 'pused' don't need under FreeBSD(allBSD?). It useless.

    Also we already have 'total', 'free' and 'cached' modes. It usefull under FreeBSD.
    As I see in src (src/libs/zbxsysinfo/freebsd/memory.c) 'total' memory calculate as "vm.stats.vm.v_page_count" * "vm.stats.vm.v_page_size".
    'free' memory = "vm.stats.vm.v_free_count" * "vm.stats.vm.v_page_size".
    'cached' memory = "vm.stats.vm.v_cache_count" * "vm.stats.vm.v_page_size"
    This is good and right!

    But we also need 'active', 'inactive' and 'wired' modes for vm.memory.size key under FreeBSD(BSD)!
    We may calculate 'active' mem as "vm.stats.vm.v_active_count" * "vm.stats.vm.v_page_size"
    'inactive' = "vm.stats.vm.v_inactive_count" * "vm.stats.vm.v_page_size"
    'wired' = "vm.stats.vm.v_wire_count" * "vm.stats.vm.v_page_size" (sysctl var contains 'wire', not 'wired')

    If you add up all this memory you get 'total' memory.
    I.e. 'total' = 'active' + 'wired' + 'cache' + 'inactive' + 'free'

    In FreeBSD 'free' memory doesn't mean REAL free memory available for programs.
    Actually used memory in FreeBSD is 'active' + 'wired'. And real free mem is 'cache' + 'inactive' + 'free'.
    Under load 'active' and 'wired' types of memory are growing and other types are decreasing.
    When 'cache', 'inactive' and 'free' will be tiny system will be active use swap.

    I can provied graphics if you want.
    And if you don't have enough time I can try to provide patches for src/libs/zbxsysinfo/freebsd/memory.c, but I have small experience in C programming.
    Last edited by Mox; 05-05-2011, 13:25.
  • Mox
    Member
    • Sep 2009
    • 90

    #2

    Comment

    • Mox
      Member
      • Sep 2009
      • 90

      #3
      Please, test it

      Just copy this file to /usr/ports/net-mgmt/zabbix-server/files/ directory and reinstall zabbix_agent

      Comment

      Working...