summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVailin Choi <vchoi@hdfgroup.org>2019-02-06 16:49:51 (GMT)
committerVailin Choi <vchoi@jam.ad.hdfgroup.org>2019-02-06 18:02:36 (GMT)
commit29fc6bcd77b0e975d807ecedf16b998493f88bb0 (patch)
tree252f04ce82bbac557bfe2d564917c05af7b3843d
parent9063babaaa9b3c11a686ca9faefb70aa2091c21a (diff)
downloadhdf5-29fc6bcd77b0e975d807ecedf16b998493f88bb0.zip
hdf5-29fc6bcd77b0e975d807ecedf16b998493f88bb0.tar.gz
hdf5-29fc6bcd77b0e975d807ecedf16b998493f88bb0.tar.bz2
Merge pull request #1522 in HDFFV/hdf5 from ~VCHOI/my_hdf5_fork:develop to develop
* commit '7f5741825db0737db5ac46c43009681508a73002': Add release notes information. Modification based on feedback from pull request. Modification based on feedback from pull request. There is performance issue when closing an object. The slow down is due to the search of the "tag_list" to find out the "corked" status of an object. The fix: (1) Add a counter "num_objs_corked" in the cache structure to track the number of "corked" objects. (2) Skip the search of "tag_list" if the counter is zero i.e. no "corked" objects. Conflicts: release_docs/RELEASE.txt
-rw-r--r--release_docs/RELEASE.txt10
-rw-r--r--src/H5AC.c14
-rw-r--r--src/H5C.c4
-rw-r--r--src/H5Cpkg.h8
-rw-r--r--src/H5Cprivate.h1
-rw-r--r--src/H5Ctag.c26
6 files changed, 61 insertions, 2 deletions
diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt
index fd8de96..2333e26 100644
--- a/release_docs/RELEASE.txt
+++ b/release_docs/RELEASE.txt
@@ -338,6 +338,16 @@ Bug Fixes since HDF5-1.10.3 release
Library
-------
+ - Performance issue when closing an object
+
+ The slow down is due to the search of the "tag_list" to find
+ out the "corked" status of an object and "uncork" it if so.
+
+ Improve porformance by skipping the search of the "tag_list"
+ if there are no "corked" objects when closing an object.
+
+ (VC - 2019/2/6)
+
- Revert H5Oget_info* and H5Ovisit* functions
In 1.10.3 new H5Oget_info*2 and H5Ovisit*2 functions were
diff --git a/src/H5AC.c b/src/H5AC.c
index 7315030..6714bed 100644
--- a/src/H5AC.c
+++ b/src/H5AC.c
@@ -2403,8 +2403,18 @@ H5AC_cork(H5F_t *f, haddr_t obj_addr, unsigned action, hbool_t *corked)
HDassert(H5F_addr_defined(obj_addr));
HDassert(action == H5AC__SET_CORK || action == H5AC__UNCORK || action == H5AC__GET_CORKED);
- if(action == H5AC__GET_CORKED)
- HDassert(corked);
+ /* Skip the search on "tag_list" when there are no "corked" objects.
+ * This is done to mitigate the slow down when closing objects.
+ * Re-visit this optimization when we optimize tag info management
+ * in the future.
+ */
+ if(action == H5AC__GET_CORKED) {
+ HDassert(corked);
+ if(H5C_get_num_objs_corked(f->shared->cache) == 0) {
+ *corked = FALSE;
+ HGOTO_DONE(SUCCEED)
+ }
+ }
if(H5C_cork(f->shared->cache, obj_addr, action, corked) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Cannot perform the cork action")
diff --git a/src/H5C.c b/src/H5C.c
index e5f734c..3e4f1ad 100644
--- a/src/H5C.c
+++ b/src/H5C.c
@@ -327,6 +327,7 @@ H5C_create(size_t max_cache_size,
/* Tagging Field Initializations */
cache_ptr->ignore_tags = FALSE;
+ cache_ptr->num_objs_corked = 0;
cache_ptr->slist_changed = FALSE;
cache_ptr->slist_len = 0;
@@ -7732,6 +7733,8 @@ H5C_cork(H5C_t *cache_ptr, haddr_t obj_addr, unsigned action, hbool_t *corked)
/* Set the corked status for the entire object */
tag_info->corked = TRUE;
+ cache_ptr->num_objs_corked++;
+
} /* end if */
else {
/* Sanity check */
@@ -7743,6 +7746,7 @@ H5C_cork(H5C_t *cache_ptr, haddr_t obj_addr, unsigned action, hbool_t *corked)
/* Set the corked status for the entire object */
tag_info->corked = FALSE;
+ cache_ptr->num_objs_corked--;
/* Remove the tag info from the tag list, if there's no more entries with this tag */
if(0 == tag_info->entry_cnt) {
diff --git a/src/H5Cpkg.h b/src/H5Cpkg.h
index 9201afb..9156c0d 100644
--- a/src/H5Cpkg.h
+++ b/src/H5Cpkg.h
@@ -3823,6 +3823,13 @@ typedef struct H5C_tag_info_t {
*
* ignore_tags: Boolean flag to disable tag validation during entry insertion.
*
+ * num_objs_corked: Unsigned integer field containing the number of objects
+ * that are "corked". The "corked" status of an object is
+ * found by searching the "tag_list". This field is added
+ * for optimization so that the skip list search on "tag_list"
+ * can be skipped if this field is zero, i.e. no "corked"
+ * objects.
+ *
* When a cache entry is protected, it must be removed from the LRU
* list(s) as it cannot be either flushed or evicted until it is unprotected.
* The following fields are used to implement the protected list (pl).
@@ -4693,6 +4700,7 @@ struct H5C_t {
/* Fields for maintaining list of tagged entries */
H5SL_t * tag_list;
hbool_t ignore_tags;
+ uint32_t num_objs_corked;
/* Fields for tracking protected entries */
uint32_t pl_len;
diff --git a/src/H5Cprivate.h b/src/H5Cprivate.h
index c39c1df..d4ed6fc 100644
--- a/src/H5Cprivate.h
+++ b/src/H5Cprivate.h
@@ -2301,6 +2301,7 @@ H5_DLL herr_t H5C_validate_resize_config(H5C_auto_size_ctl_t *config_ptr,
unsigned int tests);
H5_DLL herr_t H5C_ignore_tags(H5C_t *cache_ptr);
H5_DLL hbool_t H5C_get_ignore_tags(const H5C_t *cache_ptr);
+H5_DLL uint32_t H5C_get_num_objs_corked(const H5C_t *cache_ptr);
H5_DLL herr_t H5C_retag_entries(H5C_t * cache_ptr, haddr_t src_tag, haddr_t dest_tag);
H5_DLL herr_t H5C_cork(H5C_t *cache_ptr, haddr_t obj_addr, unsigned action, hbool_t *corked);
H5_DLL herr_t H5C_get_entry_ring(const H5F_t *f, haddr_t addr, H5C_ring_t *ring);
diff --git a/src/H5Ctag.c b/src/H5Ctag.c
index 66aedd9..d1ede0f 100644
--- a/src/H5Ctag.c
+++ b/src/H5Ctag.c
@@ -175,6 +175,32 @@ H5C_get_ignore_tags(const H5C_t *cache_ptr)
/*-------------------------------------------------------------------------
*
+ * Function: H5C_get_num_objs_corked
+ *
+ * Purpose: Retrieve the 'num_objs_corked' field for the cache
+ *
+ * Return: 'num_objs_corked' value (can't fail)
+ *
+ * Programmer: Vailin Choi; Feb 2019
+ *
+ *-------------------------------------------------------------------------
+ */
+uint32_t
+H5C_get_num_objs_corked(const H5C_t *cache_ptr)
+{
+ FUNC_ENTER_NOAPI_NOERR
+
+ /* Sanity checks */
+ HDassert(cache_ptr);
+ HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC);
+
+ /* Return value for num_objs_corked */
+ FUNC_LEAVE_NOAPI(cache_ptr->num_objs_corked)
+} /* H5C_get_num_objs_corked */
+
+
+/*-------------------------------------------------------------------------
+ *
* Function: H5C__tag_entry
*
* Purpose: Tags an entry with the provided tag (contained in the API context).