mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 14:54:52 +02:00
8324598: use mem_unit when working with sysinfo memory and swap related information
Reviewed-by: dholmes, mdoerr
This commit is contained in:
parent
6d36eb78ad
commit
7a798d3ceb
2 changed files with 3 additions and 3 deletions
|
@ -417,7 +417,7 @@ pid_t os::Linux::gettid() {
|
||||||
julong os::Linux::host_swap() {
|
julong os::Linux::host_swap() {
|
||||||
struct sysinfo si;
|
struct sysinfo si;
|
||||||
sysinfo(&si);
|
sysinfo(&si);
|
||||||
return (julong)si.totalswap;
|
return (julong)(si.totalswap * si.mem_unit);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Most versions of linux have a bug where the number of processors are
|
// Most versions of linux have a bug where the number of processors are
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2020, Red Hat, Inc.
|
* Copyright (c) 2020, 2024, Red Hat, Inc.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -54,5 +54,5 @@ Java_jdk_internal_platform_CgroupMetrics_getTotalSwapSize0
|
||||||
if (retval < 0) {
|
if (retval < 0) {
|
||||||
return 0; // syinfo failed, treat as no swap
|
return 0; // syinfo failed, treat as no swap
|
||||||
}
|
}
|
||||||
return (jlong)si.totalswap;
|
return (jlong)(si.totalswap * si.mem_unit);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue