8267945: ZGC: Revert NUMA changes (JDK-8266217 and JDK-8241354) after JDK-8241423
Reviewed-by: pliden
This commit is contained in:
parent
6627432025
commit
9031477f27
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2019, 2021, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -25,7 +25,7 @@
|
||||
#include "gc/z/zNUMA.hpp"
|
||||
|
||||
void ZNUMA::pd_initialize() {
|
||||
_state = Disabled;
|
||||
_enabled = false;
|
||||
}
|
||||
|
||||
uint32_t ZNUMA::count() {
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2016, 2021, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2016, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -24,39 +24,17 @@
|
||||
#include "gc/z/zCPU.inline.hpp"
|
||||
#include "gc/z/zErrno.hpp"
|
||||
#include "gc/z/zNUMA.hpp"
|
||||
#include "gc/z/zNUMA.inline.hpp"
|
||||
#include "gc/z/zSyscall_linux.hpp"
|
||||
#include "runtime/globals.hpp"
|
||||
#include "runtime/globals_extension.hpp"
|
||||
#include "runtime/os.hpp"
|
||||
#include "utilities/debug.hpp"
|
||||
|
||||
static bool numa_memory_id(void* addr, uint32_t* id) {
|
||||
return ZSyscall::get_mempolicy((int*)id, NULL, 0, addr, MPOL_F_NODE | MPOL_F_ADDR) != -1;
|
||||
}
|
||||
|
||||
static bool is_numa_supported() {
|
||||
// Test if syscall is available
|
||||
uint32_t dummy = 0;
|
||||
const bool available = numa_memory_id(&dummy, &dummy);
|
||||
|
||||
if (!available && !FLAG_IS_DEFAULT(UseNUMA)) {
|
||||
warning("NUMA support disabled, system call get_mempolicy not available");
|
||||
}
|
||||
|
||||
return available;
|
||||
}
|
||||
|
||||
void ZNUMA::pd_initialize() {
|
||||
if (!UseNUMA) {
|
||||
_state = Disabled;
|
||||
} else {
|
||||
_state = is_numa_supported() ? Enabled : Unsupported;
|
||||
}
|
||||
_enabled = UseNUMA;
|
||||
}
|
||||
|
||||
uint32_t ZNUMA::count() {
|
||||
if (!is_enabled()) {
|
||||
if (!_enabled) {
|
||||
// NUMA support not enabled
|
||||
return 1;
|
||||
}
|
||||
@ -65,7 +43,7 @@ uint32_t ZNUMA::count() {
|
||||
}
|
||||
|
||||
uint32_t ZNUMA::id() {
|
||||
if (!is_enabled()) {
|
||||
if (!_enabled) {
|
||||
// NUMA support not enabled
|
||||
return 0;
|
||||
}
|
||||
@ -74,14 +52,14 @@ uint32_t ZNUMA::id() {
|
||||
}
|
||||
|
||||
uint32_t ZNUMA::memory_id(uintptr_t addr) {
|
||||
if (!is_enabled()) {
|
||||
if (!_enabled) {
|
||||
// NUMA support not enabled, assume everything belongs to node zero
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint32_t id = (uint32_t)-1;
|
||||
|
||||
if (!numa_memory_id((void*)addr, &id)) {
|
||||
if (ZSyscall::get_mempolicy((int*)&id, NULL, 0, (void*)addr, MPOL_F_NODE | MPOL_F_ADDR) == -1) {
|
||||
ZErrno err;
|
||||
fatal("Failed to get NUMA id for memory at " PTR_FORMAT " (%s)", addr, err.to_string());
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2019, 2021, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -25,7 +25,7 @@
|
||||
#include "gc/z/zNUMA.hpp"
|
||||
|
||||
void ZNUMA::pd_initialize() {
|
||||
_state = Disabled;
|
||||
_enabled = false;
|
||||
}
|
||||
|
||||
uint32_t ZNUMA::count() {
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2016, 2021, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2016, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -24,28 +24,18 @@
|
||||
#include "precompiled.hpp"
|
||||
#include "gc/shared/gcLogPrecious.hpp"
|
||||
#include "gc/z/zNUMA.hpp"
|
||||
#include "gc/z/zNUMA.inline.hpp"
|
||||
|
||||
ZNUMA::State ZNUMA::_state;
|
||||
bool ZNUMA::_enabled;
|
||||
|
||||
void ZNUMA::initialize() {
|
||||
pd_initialize();
|
||||
|
||||
log_info_p(gc, init)("NUMA Support: %s", to_string());
|
||||
if (is_enabled()) {
|
||||
if (_enabled) {
|
||||
log_info_p(gc, init)("NUMA Nodes: %u", count());
|
||||
}
|
||||
}
|
||||
|
||||
const char* ZNUMA::to_string() {
|
||||
switch (_state) {
|
||||
case Enabled:
|
||||
return "Enabled";
|
||||
|
||||
case Unsupported:
|
||||
return "Unsupported";
|
||||
|
||||
default:
|
||||
return "Disabled";
|
||||
}
|
||||
return _enabled ? "Enabled" : "Disabled";
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2016, 2021, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2016, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -28,13 +28,7 @@
|
||||
|
||||
class ZNUMA : public AllStatic {
|
||||
private:
|
||||
enum State {
|
||||
Disabled,
|
||||
Enabled,
|
||||
Unsupported
|
||||
};
|
||||
|
||||
static State _state;
|
||||
static bool _enabled;
|
||||
|
||||
static void pd_initialize();
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2019, 2021, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2019, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -27,7 +27,7 @@
|
||||
#include "gc/z/zNUMA.hpp"
|
||||
|
||||
inline bool ZNUMA::is_enabled() {
|
||||
return _state == Enabled;
|
||||
return _enabled;
|
||||
}
|
||||
|
||||
#endif // SHARE_GC_Z_ZNUMA_INLINE_HPP
|
||||
|
Loading…
Reference in New Issue
Block a user