public icon indicating copy to clipboard operation
public copied to clipboard

Meaning of /system/memory/state/reserved leaf is unclear.

Open LeonGWang opened this issue 2 years ago • 5 comments

In https://github.com/openconfig/public/blob/master/release/models/system/openconfig-system.yang, under

  grouping system-memory-state {
    description
      "Operational state data for system memory";

    leaf physical {
      type uint64;
      units bytes;
      // TODO: consider making units in megabytes
      description
        "Reports the total physical memory available on the
        system.";
    }

    leaf reserved {
      type uint64;
      units bytes;
      description
        "Memory reserved for system use";
    }

    leaf used {
      type uint64;
      units bytes;
      description
        "Memory that has been used and not available for allocation.";
    }

    leaf free {
      type uint64;
      units bytes;
      description
        "Memory that is not used and is available for allocation.";
    }
  }

The meaning of physical, used, and free leaves are clear. It is straightforward to see that used + free = physical.

However, the meaning of the reserved leaf is vague. What does it mean exactly? Does it mean kernel memory?

And is it separate from free and used memory, such that reserved + free + used = physical? Or is it part of used memory, sich that reserved + non-reserved = used?

LeonGWang avatar Mar 04 '22 01:03 LeonGWang

My interpretation is:

used + free = physical

reserved + memory taken by processes = used

dplore avatar Mar 05 '22 00:03 dplore

Thanks for the clarification Darren!

Do you know where to look for the reserved memory value on a linux system? It's not listed directly under /proc/meminfo and there doesn't seem to be any combination of fields in /proc/meminfo that can add to approximate the value of reserved memory.

LeonGWang avatar Mar 11 '22 02:03 LeonGWang

This issue is stale because it has been open 180 days with no activity. If you wish to keep this issue active, please remove the stale label or add a comment, otherwise will be closed in 14 days.

github-actions[bot] avatar May 20 '24 02:05 github-actions[bot]

@LeonGWang I am not finding a reference for this. The kernel.org references I can found to expose data related to kernel reserved memory don't directly provide a 'reserved' statistic. I also found only /proc/meminfo and also /proc/iomem which are both references I've found related to showing kernel memory allocations don't output anything useful about reserved memory usage.

Perhaps we should remove this leaf as it is ambiguous.

dplore avatar May 20 '24 20:05 dplore

@dplore Sorry about the delay in reply. I agree with your assessment that reserved statistic is not natively provided by Linux and have no objection to removing the reserved leaf from the YANG model.

LeonGWang avatar Jun 18 '24 19:06 LeonGWang