RFR: 8334489: Add function os::used_memory [v2]
Johan Sjölen
jsjolen at openjdk.org
Wed Jun 19 16:47:38 UTC 2024
On Wed, 19 Jun 2024 10:43:50 GMT, David Holmes <dholmes at openjdk.org> wrote:
>> Johan Sjölen has updated the pull request incrementally with one additional commit since the last revision:
>>
>> Ifdef instead
>
> I think in this case I'd prefer to have an ifdef LINUX in a single shared version in os.cpp rather than duplicating the function this way.
@dholmes-ora
> I think in this case I'd prefer to have an ifdef LINUX in a single shared version in os.cpp rather than duplicating the function this way.
That's nice, let's do that.
@tstuefe
> You subtract available from physical. Why not free from physical?
`os::free_memory()` is just `available_memory()` on all of our platforms. I thought it was weird that we have two of them which are identical, so I just picked the one that is defined.
>What is your definition of used? Used, as in "used by user processes", or used as in "used by anything on the machine, including kernel-side caches"?
The latter, but machine can be replaced by "the container". To quote:
>[memory.current] Shows the total amount of memory currently being used by the cgroup and its descendants. It includes page cache, in-kernel data structures such as inodes, and network buffers.
That should be a viable explanation for the non-container case also.
-------------
PR Comment: https://git.openjdk.org/jdk/pull/19772#issuecomment-2179112191
More information about the hotspot-runtime-dev
mailing list