src/share/vm/gc/shared/plab.cpp

Print this page

        

*** 1,7 **** /* ! * Copyright (c) 2001, 2016, 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 * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. --- 1,7 ---- /* ! * Copyright (c) 2001, 2017, 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 * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation.
*** 152,183 **** } assert(is_object_aligned(max_size()) && min_size() <= max_size(), "PLAB clipping computation may be incorrect"); ! if (_allocated == 0) { ! assert(_unused == 0, "Inconsistency in PLAB stats: " "_allocated: " SIZE_FORMAT ", " "_wasted: " SIZE_FORMAT ", " "_unused: " SIZE_FORMAT ", " "_undo_wasted: " SIZE_FORMAT, _allocated, _wasted, _unused, _undo_wasted); ! _allocated = 1; ! } ! double wasted_frac = (double)_unused / (double)_allocated; size_t target_refills = (size_t)((wasted_frac * TargetSurvivorRatio) / TargetPLABWastePct); if (target_refills == 0) { target_refills = 1; } ! size_t used = _allocated - _wasted - _unused; // Assumed to have 1 gc worker thread size_t recent_plab_sz = used / target_refills; ! // Take historical weighted average ! _filter.sample(recent_plab_sz); ! _desired_net_plab_sz = MAX2(min_size(), (size_t)_filter.average()); ! ! log_sizing(recent_plab_sz, _desired_net_plab_sz); ! ! reset(); } --- 152,186 ---- } assert(is_object_aligned(max_size()) && min_size() <= max_size(), "PLAB clipping computation may be incorrect"); ! assert(_allocated != 0 || _unused == 0, "Inconsistency in PLAB stats: " "_allocated: " SIZE_FORMAT ", " "_wasted: " SIZE_FORMAT ", " "_unused: " SIZE_FORMAT ", " "_undo_wasted: " SIZE_FORMAT, _allocated, _wasted, _unused, _undo_wasted); ! size_t plab_sz = compute_desired_plab_sz(); ! // Take historical weighted average ! _filter.sample(plab_sz); ! _desired_net_plab_sz = MAX2(min_size(), (size_t)_filter.average()); ! ! log_sizing(plab_sz, _desired_net_plab_sz); ! // Clear accumulators for next round ! reset(); ! } ! ! size_t PLABStats::compute_desired_plab_sz() { ! size_t allocated = MAX2(_allocated, size_t(1)); ! double wasted_frac = (double)_unused / (double)allocated; size_t target_refills = (size_t)((wasted_frac * TargetSurvivorRatio) / TargetPLABWastePct); if (target_refills == 0) { target_refills = 1; } ! size_t used = allocated - _wasted - _unused; // Assumed to have 1 gc worker thread size_t recent_plab_sz = used / target_refills; ! return recent_plab_sz; }