File tree Expand file tree Collapse file tree 6 files changed +37
-16
lines changed
Expand file tree Collapse file tree 6 files changed +37
-16
lines changed Original file line number Diff line number Diff line change 11/*
2- * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
2+ * Copyright (c) 2019, 2021, 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
2525#include " gc/z/zNUMA.hpp"
2626
2727void ZNUMA::pd_initialize () {
28- _enabled = false ;
28+ _state = Disabled ;
2929}
3030
3131uint32_t ZNUMA::count () {
Original file line number Diff line number Diff line change 2424#include " gc/z/zCPU.inline.hpp"
2525#include " gc/z/zErrno.hpp"
2626#include " gc/z/zNUMA.hpp"
27+ #include " gc/z/zNUMA.inline.hpp"
2728#include " gc/z/zSyscall_linux.hpp"
2829#include " runtime/globals.hpp"
2930#include " runtime/globals_extension.hpp"
@@ -47,11 +48,15 @@ static bool is_numa_supported() {
4748}
4849
4950void ZNUMA::pd_initialize () {
50- _enabled = UseNUMA && is_numa_supported ();
51+ if (!UseNUMA) {
52+ _state = Disabled;
53+ } else {
54+ _state = is_numa_supported () ? Enabled : Unsupported;
55+ }
5156}
5257
5358uint32_t ZNUMA::count () {
54- if (!_enabled ) {
59+ if (!is_enabled () ) {
5560 // NUMA support not enabled
5661 return 1 ;
5762 }
@@ -60,7 +65,7 @@ uint32_t ZNUMA::count() {
6065}
6166
6267uint32_t ZNUMA::id () {
63- if (!_enabled ) {
68+ if (!is_enabled () ) {
6469 // NUMA support not enabled
6570 return 0 ;
6671 }
@@ -69,7 +74,7 @@ uint32_t ZNUMA::id() {
6974}
7075
7176uint32_t ZNUMA::memory_id (uintptr_t addr) {
72- if (!_enabled ) {
77+ if (!is_enabled () ) {
7378 // NUMA support not enabled, assume everything belongs to node zero
7479 return 0 ;
7580 }
Original file line number Diff line number Diff line change 11/*
2- * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
2+ * Copyright (c) 2019, 2021, 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
2525#include " gc/z/zNUMA.hpp"
2626
2727void ZNUMA::pd_initialize () {
28- _enabled = false ;
28+ _state = Disabled ;
2929}
3030
3131uint32_t ZNUMA::count () {
Original file line number Diff line number Diff line change 11/*
2- * Copyright (c) 2016, 2020 , Oracle and/or its affiliates. All rights reserved.
2+ * Copyright (c) 2016, 2021 , 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
2424#include " precompiled.hpp"
2525#include " gc/shared/gcLogPrecious.hpp"
2626#include " gc/z/zNUMA.hpp"
27+ #include " gc/z/zNUMA.inline.hpp"
2728
28- bool ZNUMA::_enabled ;
29+ ZNUMA::State ZNUMA::_state ;
2930
3031void ZNUMA::initialize () {
3132 pd_initialize ();
3233
3334 log_info_p (gc, init)(" NUMA Support: %s" , to_string ());
34- if (_enabled ) {
35+ if (is_enabled () ) {
3536 log_info_p (gc, init)(" NUMA Nodes: %u" , count ());
3637 }
3738}
3839
3940const char * ZNUMA::to_string () {
40- return _enabled ? " Enabled" : " Disabled" ;
41+ switch (_state) {
42+ case Enabled:
43+ return " Enabled" ;
44+
45+ case Unsupported:
46+ return " Unsupported" ;
47+
48+ default :
49+ return " Disabled" ;
50+ }
4151}
Original file line number Diff line number Diff line change 11/*
2- * Copyright (c) 2016, 2020 , Oracle and/or its affiliates. All rights reserved.
2+ * Copyright (c) 2016, 2021 , 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
2828
2929class ZNUMA : public AllStatic {
3030private:
31- static bool _enabled;
31+ enum State {
32+ Disabled,
33+ Enabled,
34+ Unsupported
35+ };
36+
37+ static State _state;
3238
3339 static void pd_initialize ();
3440
Original file line number Diff line number Diff line change 11/*
2- * Copyright (c) 2019, 2020 , Oracle and/or its affiliates. All rights reserved.
2+ * Copyright (c) 2019, 2021 , 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
2727#include " gc/z/zNUMA.hpp"
2828
2929inline bool ZNUMA::is_enabled () {
30- return _enabled ;
30+ return _state == Enabled ;
3131}
3232
3333#endif // SHARE_GC_Z_ZNUMA_INLINE_HPP
You can’t perform that action at this time.
0 commit comments