Skip to content

Commit 7e3bc81

Browse files
committed
8351216: ZGC: Store NUMA node count
Reviewed-by: tschatzl, sjohanss, eosterlund
1 parent 82eb780 commit 7e3bc81

File tree

7 files changed

+18
-24
lines changed

7 files changed

+18
-24
lines changed

src/hotspot/os/bsd/gc/z/zNUMA_bsd.cpp

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,7 @@
2626

2727
void ZNUMA::pd_initialize() {
2828
_enabled = false;
29-
}
30-
31-
uint32_t ZNUMA::count() {
32-
return 1;
29+
_count = 1;
3330
}
3431

3532
uint32_t ZNUMA::id() {

src/hotspot/os/linux/gc/z/zNUMA_linux.cpp

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2016, 2023, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2016, 2025, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -32,15 +32,9 @@
3232

3333
void ZNUMA::pd_initialize() {
3434
_enabled = UseNUMA;
35-
}
36-
37-
uint32_t ZNUMA::count() {
38-
if (!_enabled) {
39-
// NUMA support not enabled
40-
return 1;
41-
}
42-
43-
return os::Linux::numa_max_node() + 1;
35+
_count = UseNUMA
36+
? os::Linux::numa_max_node() + 1
37+
: 1;
4438
}
4539

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

68-
assert(id < count(), "Invalid NUMA id");
62+
assert(id < _count, "Invalid NUMA id");
6963

7064
return id;
7165
}

src/hotspot/os/windows/gc/z/zNUMA_windows.cpp

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,7 @@
2525

2626
void ZNUMA::pd_initialize() {
2727
_enabled = false;
28-
}
29-
30-
uint32_t ZNUMA::count() {
31-
return 1;
28+
_count = 1;
3229
}
3330

3431
uint32_t ZNUMA::id() {

src/hotspot/share/gc/z/zNUMA.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,14 @@
2525
#include "gc/z/zNUMA.hpp"
2626

2727
bool ZNUMA::_enabled;
28+
uint32_t ZNUMA::_count;
2829

2930
void ZNUMA::initialize() {
3031
pd_initialize();
3132

3233
log_info_p(gc, init)("NUMA Support: %s", to_string());
3334
if (_enabled) {
34-
log_info_p(gc, init)("NUMA Nodes: %u", count());
35+
log_info_p(gc, init)("NUMA Nodes: %u", _count);
3536
}
3637
}
3738

src/hotspot/share/gc/z/zNUMA.hpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2016, 2022, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2016, 2025, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -29,7 +29,8 @@
2929

3030
class ZNUMA : public AllStatic {
3131
private:
32-
static bool _enabled;
32+
static bool _enabled;
33+
static uint32_t _count;
3334

3435
static void pd_initialize();
3536

src/hotspot/share/gc/z/zNUMA.inline.hpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2019, 2020, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2019, 2025, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -30,4 +30,8 @@ inline bool ZNUMA::is_enabled() {
3030
return _enabled;
3131
}
3232

33+
inline uint32_t ZNUMA::count() {
34+
return _count;
35+
}
36+
3337
#endif // SHARE_GC_Z_ZNUMA_INLINE_HPP

src/hotspot/share/gc/z/zPageCache.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323

2424
#include "gc/z/zGlobals.hpp"
2525
#include "gc/z/zList.inline.hpp"
26-
#include "gc/z/zNUMA.hpp"
26+
#include "gc/z/zNUMA.inline.hpp"
2727
#include "gc/z/zPage.inline.hpp"
2828
#include "gc/z/zPageCache.hpp"
2929
#include "gc/z/zStat.hpp"

0 commit comments

Comments
 (0)