Skip to content
Permalink
Browse files
8266217: ZGC: Improve the -Xlog:gc+init output for NUMA
Reviewed-by: stefank, tschatzl, pliden
  • Loading branch information
DamonFool committed Apr 29, 2021
1 parent 5d8c1cc commit 5ecef01c4a9c7994a0fd20f926d0571c0c719f6e
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2019, 2021, 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() {
_enabled = false;
_state = Disabled;
}

uint32_t ZNUMA::count() {
@@ -24,6 +24,7 @@
#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"
@@ -47,11 +48,15 @@ static bool is_numa_supported() {
}

void ZNUMA::pd_initialize() {
_enabled = UseNUMA && is_numa_supported();
if (!UseNUMA) {
_state = Disabled;
} else {
_state = is_numa_supported() ? Enabled : Unsupported;
}
}

uint32_t ZNUMA::count() {
if (!_enabled) {
if (!is_enabled()) {
// NUMA support not enabled
return 1;
}
@@ -60,7 +65,7 @@ uint32_t ZNUMA::count() {
}

uint32_t ZNUMA::id() {
if (!_enabled) {
if (!is_enabled()) {
// NUMA support not enabled
return 0;
}
@@ -69,7 +74,7 @@ uint32_t ZNUMA::id() {
}

uint32_t ZNUMA::memory_id(uintptr_t addr) {
if (!_enabled) {
if (!is_enabled()) {
// NUMA support not enabled, assume everything belongs to node zero
return 0;
}
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2019, 2021, 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() {
_enabled = false;
_state = Disabled;
}

uint32_t ZNUMA::count() {
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2016, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2016, 2021, 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,18 +24,28 @@
#include "precompiled.hpp"
#include "gc/shared/gcLogPrecious.hpp"
#include "gc/z/zNUMA.hpp"
#include "gc/z/zNUMA.inline.hpp"

bool ZNUMA::_enabled;
ZNUMA::State ZNUMA::_state;

void ZNUMA::initialize() {
pd_initialize();

log_info_p(gc, init)("NUMA Support: %s", to_string());
if (_enabled) {
if (is_enabled()) {
log_info_p(gc, init)("NUMA Nodes: %u", count());
}
}

const char* ZNUMA::to_string() {
return _enabled ? "Enabled" : "Disabled";
switch (_state) {
case Enabled:
return "Enabled";

case Unsupported:
return "Unsupported";

default:
return "Disabled";
}
}
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2016, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2016, 2021, 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,7 +28,13 @@

class ZNUMA : public AllStatic {
private:
static bool _enabled;
enum State {
Disabled,
Enabled,
Unsupported
};

static State _state;

static void pd_initialize();

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2019, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2019, 2021, 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 _enabled;
return _state == Enabled;
}

#endif // SHARE_GC_Z_ZNUMA_INLINE_HPP

1 comment on commit 5ecef01

@openjdk-notifier

This comment has been minimized.

Copy link

@openjdk-notifier openjdk-notifier bot commented on 5ecef01 Apr 29, 2021

Please sign in to comment.