RFR: 8359104: gc/TestAlwaysPreTouchBehavior.java#<gcname> fails on Linux

Francesco Andreuzzi duke at openjdk.org
Wed Sep 10 14:35:42 UTC 2025


On Wed, 10 Sep 2025 13:55:59 GMT, Andreas Steiner <asteiner at openjdk.org> wrote:

> Get accurate RSS, from smaps_rollup if available(Linux >= 4.14), because the RSS from status is inaccurate especially on systems with more than 32 CPUs.
> 
> Not sure if all the additional meminfos like the Pss, Pss_dirty, Pss_Anon, Pss_File, Pss_Shmem, Swap and SwapPss are really needed too. But can be perhaps helpful too.
> 
> As the inaccurate memory infos are still used in other methods:
> - [print_process_memory_info()](https://github.com/openjdk/jdk/blob/385c13298932f1de16e6161652be35d966d822ec/src/hotspot/os/linux/os_linux.cpp#L2393)
> - [jfr_report_memory_info()](https://github.com/openjdk/jdk/blob/385c13298932f1de16e6161652be35d966d822ec/src/hotspot/os/linux/os_linux.cpp#L2686)
> - [trim_native_heap()](https://github.com/openjdk/jdk/blob/385c13298932f1de16e6161652be35d966d822ec/src/hotspot/os/linux/os_linux.cpp#L5376)
> 
> one can think about to use the accurate values there too.

src/hotspot/os/linux/os_linux.cpp line 2377:

> 2375: bool os::Linux::query_accurate_process_memory_info(os::Linux::accurate_meminfo_t* info) {
> 2376:   FILE* f = os::fopen("/proc/self/smaps_rollup", "r");
> 2377:   const int num_values = sizeof(os::Linux::accurate_meminfo_t) / sizeof(size_t);

Should this and `num_found` be `size_t`?

src/hotspot/os/linux/os_linux.cpp line 2382:

> 2380:   info->rss = info->pss = info->pssdirty = info->pssanon =
> 2381:       info->pssfile = info->pssshmem = info->swap = info->swappss = -1;
> 2382:   if (f != nullptr) {

You could consider inverting this check, and early-return `false` if `f==nullptr`. That would spare one indentation level

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/27192#discussion_r2336978504
PR Review Comment: https://git.openjdk.org/jdk/pull/27192#discussion_r2336975956


More information about the hotspot-dev mailing list