8298482: Implement ParallelGC NUMAStats for Linux

Reviewed-by: ayang, sjohanss, tschatzl
This commit is contained in:
Nick Gasson 2023-01-12 09:28:46 +00:00
parent 0ee8cac7c7
commit 036c80844e
7 changed files with 34 additions and 54 deletions

@ -1,5 +1,5 @@
/*
* Copyright (c) 1999, 2022, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1999, 2023, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 2021 SAP SE. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@ -1872,7 +1872,7 @@ int os::numa_get_group_id_for_address(const void* address) {
return 0;
}
bool os::get_page_info(char *start, page_info* info) {
bool os::numa_get_group_ids_for_range(const void** addresses, int* lgrp_ids, size_t count) {
return false;
}

@ -1,5 +1,5 @@
/*
* Copyright (c) 1999, 2022, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1999, 2023, 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
@ -1575,7 +1575,7 @@ int os::numa_get_group_id_for_address(const void* address) {
return 0;
}
bool os::get_page_info(char *start, page_info* info) {
bool os::numa_get_group_ids_for_range(const void** addresses, int* lgrp_ids, size_t count) {
return false;
}

@ -1,5 +1,5 @@
/*
* Copyright (c) 1999, 2022, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1999, 2023, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2015, 2022 SAP SE. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@ -2777,6 +2777,11 @@ int os::numa_get_group_id_for_address(const void* address) {
return id;
}
bool os::numa_get_group_ids_for_range(const void** addresses, int* lgrp_ids, size_t count) {
void** pages = const_cast<void**>(addresses);
return os::Linux::numa_move_pages(0, count, pages, NULL, lgrp_ids, 0) == 0;
}
int os::Linux::get_existing_num_nodes() {
int node;
int highest_node_number = Linux::numa_max_node();
@ -2807,10 +2812,6 @@ size_t os::numa_get_leaf_groups(int *ids, size_t size) {
return i;
}
bool os::get_page_info(char *start, page_info* info) {
return false;
}
char *os::scan_pages(char *start, char* end, page_info* page_expected,
page_info* page_found) {
return end;

@ -3727,7 +3727,7 @@ int os::numa_get_group_id_for_address(const void* address) {
return 0;
}
bool os::get_page_info(char *start, page_info* info) {
bool os::numa_get_group_ids_for_range(const void** addresses, int* lgrp_ids, size_t count) {
return false;
}

@ -1,5 +1,5 @@
/*
* Copyright (c) 2006, 2022, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2006, 2023, 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
@ -376,12 +376,6 @@ void MutableNUMASpace::update() {
}
}
if (NUMAStats) {
for (int i = 0; i < lgrp_spaces()->length(); i++) {
lgrp_spaces()->at(i)->accumulate_statistics(page_size());
}
}
scan_pages(NUMAPageScanRate);
}
@ -405,12 +399,6 @@ void MutableNUMASpace::accumulate_statistics() {
}
increment_samples_count();
}
if (NUMAStats) {
for (int i = 0; i < lgrp_spaces()->length(); i++) {
lgrp_spaces()->at(i)->accumulate_statistics(page_size());
}
}
}
// Get the current size of a chunk.
@ -870,14 +858,11 @@ void MutableNUMASpace::print_on(outputStream* st) const {
lgrp_spaces()->at(i)->accumulate_statistics(page_size());
}
st->print(" local/remote/unbiased/uncommitted: " SIZE_FORMAT "K/"
SIZE_FORMAT "K/" SIZE_FORMAT "K/" SIZE_FORMAT
"K, large/small pages: " SIZE_FORMAT "/" SIZE_FORMAT "\n",
SIZE_FORMAT "K/" SIZE_FORMAT "K/" SIZE_FORMAT "K\n",
ls->space_stats()->_local_space / K,
ls->space_stats()->_remote_space / K,
ls->space_stats()->_unbiased_space / K,
ls->space_stats()->_uncommited_space / K,
ls->space_stats()->_large_pages,
ls->space_stats()->_small_pages);
ls->space_stats()->_uncommited_space / K);
}
}
}
@ -895,28 +880,25 @@ void MutableNUMASpace::LGRPSpace::accumulate_statistics(size_t page_size) {
clear_space_stats();
char *start = (char*)align_up(space()->bottom(), page_size);
char* end = (char*)align_down(space()->end(), page_size);
if (start < end) {
for (char *p = start; p < end;) {
os::page_info info;
if (os::get_page_info(p, &info)) {
if (info.size > 0) {
if (info.size > (size_t)os::vm_page_size()) {
space_stats()->_large_pages++;
} else {
space_stats()->_small_pages++;
}
if (info.lgrp_id == lgrp_id()) {
space_stats()->_local_space += info.size;
} else {
space_stats()->_remote_space += info.size;
}
p += info.size;
} else {
p += os::vm_page_size();
for (char *p = start; p < end; ) {
static const size_t PagesPerIteration = 128;
const void* pages[PagesPerIteration];
int lgrp_ids[PagesPerIteration];
size_t npages = 0;
for (; npages < PagesPerIteration && p < end; p += os::vm_page_size()) {
pages[npages++] = p;
}
if (os::numa_get_group_ids_for_range(pages, lgrp_ids, npages)) {
for (size_t i = 0; i < npages; i++) {
if (lgrp_ids[i] < 0) {
space_stats()->_uncommited_space += os::vm_page_size();
} else if (lgrp_ids[i] == lgrp_id()) {
space_stats()->_local_space += os::vm_page_size();
} else {
space_stats()->_remote_space += os::vm_page_size();
}
} else {
return;
}
}
}

@ -1,5 +1,5 @@
/*
* Copyright (c) 2006, 2021, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2006, 2023, 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
@ -73,15 +73,12 @@ class MutableNUMASpace : public MutableSpace {
struct SpaceStats {
size_t _local_space, _remote_space, _unbiased_space, _uncommited_space;
size_t _large_pages, _small_pages;
SpaceStats() {
_local_space = 0;
_remote_space = 0;
_unbiased_space = 0;
_uncommited_space = 0;
_large_pages = 0;
_small_pages = 0;
}
};

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2022, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2023, 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
@ -500,13 +500,13 @@ class os: AllStatic {
static bool numa_topology_changed();
static int numa_get_group_id();
static int numa_get_group_id_for_address(const void* address);
static bool numa_get_group_ids_for_range(const void** addresses, int* lgrp_ids, size_t count);
// Page manipulation
struct page_info {
size_t size;
int lgrp_id;
};
static bool get_page_info(char *start, page_info* info);
static char* scan_pages(char *start, char* end, page_info* page_expected, page_info* page_found);
static char* non_memory_address_word();