From: Maged Michael Date: Sat, 6 Jan 2018 00:10:46 +0000 (-0800) Subject: Add threshold for thread local retired objects X-Git-Tag: v2018.01.08.00~4 X-Git-Url: http://plrg.eecs.uci.edu/git/?p=folly.git;a=commitdiff_plain;h=42452e30b5695dbd38e2a0b3083e594945fb9876;hp=881088fc0341608999b30d8d06573b86f37daa42 Add threshold for thread local retired objects Summary: Change the threshold for pushing privately held retired object to the domain to a moderate constant instead of using the threshold for bulk reclamation which is too high for this purpose. Reviewed By: djwatson Differential Revision: D6665904 fbshipit-source-id: 0b090884843b0296a93af7994f7183f41c00000e --- diff --git a/folly/experimental/hazptr/hazptr-impl.h b/folly/experimental/hazptr/hazptr-impl.h index 07e6891d..5c343c5c 100644 --- a/folly/experimental/hazptr/hazptr-impl.h +++ b/folly/experimental/hazptr/hazptr-impl.h @@ -1,5 +1,5 @@ /* - * Copyright 2017 Facebook, Inc. + * Copyright 2017-present Facebook, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,7 +13,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - /* override-include-guard */ #ifndef HAZPTR_H #error "This should only be included by hazptr.h" @@ -41,6 +40,10 @@ #define HAZPTR_PRIV true #endif +#ifndef HAZPTR_PRIV_THRESHOLD +#define HAZPTR_PRIV_THRESHOLD 20 +#endif + #ifndef HAZPTR_ONE_DOMAIN #define HAZPTR_ONE_DOMAIN false #endif @@ -994,8 +997,7 @@ inline void hazptr_priv::push(hazptr_obj* obj) { head_ = obj; } tail_ = obj; - ++rcount_; - if (domain.reachedThreshold(rcount_)) { + if (++rcount_ >= HAZPTR_PRIV_THRESHOLD) { pushAllToDomain(); } }