Skip to content

8351216: ZGC: Store NUMA node count #23922

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions src/hotspot/os/bsd/gc/z/zNUMA_bsd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,7 @@

void ZNUMA::pd_initialize() {
_enabled = false;
}

uint32_t ZNUMA::count() {
return 1;
_count = 1;
}

uint32_t ZNUMA::id() {
Expand Down
16 changes: 5 additions & 11 deletions src/hotspot/os/linux/gc/z/zNUMA_linux.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2016, 2023, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2016, 2025, 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
Expand Down Expand Up @@ -32,15 +32,9 @@

void ZNUMA::pd_initialize() {
_enabled = UseNUMA;
}

uint32_t ZNUMA::count() {
if (!_enabled) {
// NUMA support not enabled
return 1;
}

return os::Linux::numa_max_node() + 1;
_count = UseNUMA
? os::Linux::numa_max_node() + 1
: 1;
}

uint32_t ZNUMA::id() {
Expand All @@ -65,7 +59,7 @@ uint32_t ZNUMA::memory_id(uintptr_t addr) {
fatal("Failed to get NUMA id for memory at " PTR_FORMAT " (%s)", addr, err.to_string());
}

assert(id < count(), "Invalid NUMA id");
assert(id < _count, "Invalid NUMA id");

return id;
}
5 changes: 1 addition & 4 deletions src/hotspot/os/windows/gc/z/zNUMA_windows.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,7 @@

void ZNUMA::pd_initialize() {
_enabled = false;
}

uint32_t ZNUMA::count() {
return 1;
_count = 1;
}

uint32_t ZNUMA::id() {
Expand Down
3 changes: 2 additions & 1 deletion src/hotspot/share/gc/z/zNUMA.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,14 @@
#include "gc/z/zNUMA.hpp"

bool ZNUMA::_enabled;
uint32_t ZNUMA::_count;

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

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

Expand Down
5 changes: 3 additions & 2 deletions src/hotspot/share/gc/z/zNUMA.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2016, 2022, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2016, 2025, 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
Expand Down Expand Up @@ -29,7 +29,8 @@

class ZNUMA : public AllStatic {
private:
static bool _enabled;
static bool _enabled;
static uint32_t _count;

static void pd_initialize();

Expand Down
6 changes: 5 additions & 1 deletion src/hotspot/share/gc/z/zNUMA.inline.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2019, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2019, 2025, 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
Expand Down Expand Up @@ -30,4 +30,8 @@ inline bool ZNUMA::is_enabled() {
return _enabled;
}

inline uint32_t ZNUMA::count() {
return _count;
}

#endif // SHARE_GC_Z_ZNUMA_INLINE_HPP
2 changes: 1 addition & 1 deletion src/hotspot/share/gc/z/zPageCache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

#include "gc/z/zGlobals.hpp"
#include "gc/z/zList.inline.hpp"
#include "gc/z/zNUMA.hpp"
#include "gc/z/zNUMA.inline.hpp"
#include "gc/z/zPage.inline.hpp"
#include "gc/z/zPageCache.hpp"
#include "gc/z/zStat.hpp"
Expand Down