From 6a2fbff85be6168186a6c49498d7bb4e53f10b8f Mon Sep 17 00:00:00 2001 From: Vailin Choi Date: Fri, 31 Jan 2014 18:15:13 -0500 Subject: [svn-r24675] 1) Add cork status to H5AC/H5C_get_entry_status(). 2) Skip dirty corked entries when doing auto ageout entries in the cache. Tested on koala, jam, platypus, ostrich. PENDING: code review and more cache related tests. --- src/H5AC.c | 5 +++- src/H5ACprivate.h | 1 + src/H5C.c | 19 +++++++++++-- src/H5Cprivate.h | 1 + test/cache.c | 80 ++++++++++++++++++++++++++++------------------------- test/cache_common.c | 39 ++++++++++++++++++++++++++ test/cache_common.h | 2 ++ 7 files changed, 106 insertions(+), 41 deletions(-) diff --git a/src/H5AC.c b/src/H5AC.c index 3f5fc83..185ede6 100644 --- a/src/H5AC.c +++ b/src/H5AC.c @@ -944,6 +944,7 @@ H5AC_get_entry_status(const H5F_t *f, hbool_t is_dirty; hbool_t is_protected; hbool_t is_pinned; + hbool_t is_corked; hbool_t is_flush_dep_child; hbool_t is_flush_dep_parent; size_t entry_size; @@ -956,7 +957,7 @@ H5AC_get_entry_status(const H5F_t *f, HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Bad param(s) on entry.") if(H5C_get_entry_status(f, addr, &entry_size, &in_cache, &is_dirty, - &is_protected, &is_pinned, &is_flush_dep_parent, &is_flush_dep_child) < 0) + &is_protected, &is_pinned, &is_corked, &is_flush_dep_parent, &is_flush_dep_child) < 0) HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "H5C_get_entry_status() failed.") if(in_cache) { @@ -967,6 +968,8 @@ H5AC_get_entry_status(const H5F_t *f, status |= H5AC_ES__IS_PROTECTED; if(is_pinned) status |= H5AC_ES__IS_PINNED; + if(is_corked) + status |= H5AC_ES__IS_CORKED; if(is_flush_dep_parent) status |= H5AC_ES__IS_FLUSH_DEP_PARENT; if(is_flush_dep_child) diff --git a/src/H5ACprivate.h b/src/H5ACprivate.h index 2fa8277..b78c277 100644 --- a/src/H5ACprivate.h +++ b/src/H5ACprivate.h @@ -352,6 +352,7 @@ H5_DLLVAR hid_t H5AC_ind_dxpl_id; #define H5AC_ES__IS_PINNED 0x0008 #define H5AC_ES__IS_FLUSH_DEP_PARENT 0x0010 #define H5AC_ES__IS_FLUSH_DEP_CHILD 0x0020 +#define H5AC_ES__IS_CORKED 0x0040 /* external function declarations: */ diff --git a/src/H5C.c b/src/H5C.c index 87a100a..9fb4317 100644 --- a/src/H5C.c +++ b/src/H5C.c @@ -2469,6 +2469,7 @@ H5C_get_entry_status(const H5F_t *f, hbool_t * is_dirty_ptr, hbool_t * is_protected_ptr, hbool_t * is_pinned_ptr, + hbool_t * is_corked_ptr, hbool_t * is_flush_dep_parent_ptr, hbool_t * is_flush_dep_child_ptr) { @@ -2529,6 +2530,11 @@ H5C_get_entry_status(const H5F_t *f, *is_pinned_ptr = entry_ptr->is_pinned; } + if ( is_corked_ptr != NULL ) { + + *is_corked_ptr = entry_ptr->is_corked; + } + if ( is_flush_dep_parent_ptr != NULL ) { *is_flush_dep_parent_ptr = (entry_ptr->flush_dep_nchildren > 0); @@ -7008,6 +7014,7 @@ H5C__autoadjust__ageout__evict_aged_out_entries(H5F_t * f, ( (entry_ptr->type)->id != H5C__EPOCH_MARKER_TYPE ) && ( bytes_evicted < eviction_size_limit ) ) { + hbool_t corked = FALSE; HDassert( ! (entry_ptr->is_protected) ); next_ptr = entry_ptr->next; @@ -7018,7 +7025,11 @@ H5C__autoadjust__ageout__evict_aged_out_entries(H5F_t * f, prev_is_dirty = prev_ptr->is_dirty; } - if ( entry_ptr->is_dirty ) { + /* dirty corked entry is skipped */ + if(entry_ptr->is_corked && entry_ptr->is_dirty) { + corked = TRUE; + result = TRUE; + } else if ( entry_ptr->is_dirty ) { result = H5C_flush_single_entry(f, primary_dxpl_id, @@ -7058,9 +7069,11 @@ H5C__autoadjust__ageout__evict_aged_out_entries(H5F_t * f, HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \ "*prev_ptr corrupt") - } else + } #endif /* NDEBUG */ - if ( ( prev_ptr->is_dirty != prev_is_dirty ) + if(corked) { /* dirty corked entry is skipped */ + entry_ptr = prev_ptr; + } else if ( ( prev_ptr->is_dirty != prev_is_dirty ) || ( prev_ptr->next != next_ptr ) || diff --git a/src/H5Cprivate.h b/src/H5Cprivate.h index 3ee74ea..6890c70 100644 --- a/src/H5Cprivate.h +++ b/src/H5Cprivate.h @@ -1166,6 +1166,7 @@ H5_DLL herr_t H5C_get_entry_status(const H5F_t *f, hbool_t * is_dirty_ptr, hbool_t * is_protected_ptr, hbool_t * is_pinned_ptr, + hbool_t * is_corked_ptr, hbool_t * is_flush_dep_parent_ptr, hbool_t * is_flush_dep_child_ptr); diff --git a/test/cache.c b/test/cache.c index 5654f6e..e08fcb5 100644 --- a/test/cache.c +++ b/test/cache.c @@ -193,7 +193,7 @@ static unsigned check_resize_entry_errs(void); static unsigned check_unprotect_ro_dirty_err(void); static unsigned check_protect_ro_rw_err(void); static unsigned check_check_evictions_enabled_err(void); -static unsigned check_auto_cache_resize(void); +static unsigned check_auto_cache_resize(hbool_t cork_ageout); static unsigned check_auto_cache_resize_disable(void); static unsigned check_auto_cache_resize_epoch_markers(void); static unsigned check_auto_cache_resize_input_errs(void); @@ -2750,7 +2750,7 @@ check_insert_entry(void) result = H5C_get_entry_status(file_ptr, entry_ptr->addr, &entry_size, &in_cache, &is_dirty, &is_protected, - &is_pinned, NULL, NULL); + &is_pinned, NULL, NULL, NULL); if ( result < 0 ) { @@ -13440,7 +13440,7 @@ check_get_entry_status(void) */ result = H5C_get_entry_status(file_ptr, entry_ptr->addr, &entry_size, - &in_cache, &is_dirty, &is_protected, &is_pinned, NULL, NULL); + &in_cache, &is_dirty, &is_protected, &is_pinned, NULL, NULL, NULL); if ( result < 0 ) { @@ -13468,7 +13468,7 @@ check_get_entry_status(void) if ( pass ) { result = H5C_get_entry_status(file_ptr, entry_ptr->addr, &entry_size, - &in_cache, &is_dirty, &is_protected, &is_pinned, NULL, NULL); + &in_cache, &is_dirty, &is_protected, &is_pinned, NULL, NULL, NULL); if ( result < 0 ) { @@ -13494,7 +13494,7 @@ check_get_entry_status(void) if ( pass ) { result = H5C_get_entry_status(file_ptr, entry_ptr->addr, &entry_size, - &in_cache, &is_dirty, &is_protected, &is_pinned, NULL, NULL); + &in_cache, &is_dirty, &is_protected, &is_pinned, NULL, NULL, NULL); if ( result < 0 ) { @@ -13520,7 +13520,7 @@ check_get_entry_status(void) if ( pass ) { result = H5C_get_entry_status(file_ptr, entry_ptr->addr, &entry_size, - &in_cache, &is_dirty, &is_protected, &is_pinned, NULL, NULL); + &in_cache, &is_dirty, &is_protected, &is_pinned, NULL, NULL, NULL); if ( result < 0 ) { @@ -13546,7 +13546,7 @@ check_get_entry_status(void) if ( pass ) { result = H5C_get_entry_status(file_ptr, entry_ptr->addr, &entry_size, - &in_cache, &is_dirty, &is_protected, &is_pinned, NULL, NULL); + &in_cache, &is_dirty, &is_protected, &is_pinned, NULL, NULL, NULL); if ( result < 0 ) { @@ -13572,7 +13572,7 @@ check_get_entry_status(void) if ( pass ) { result = H5C_get_entry_status(file_ptr, entry_ptr->addr, &entry_size, - &in_cache, &is_dirty, &is_protected, &is_pinned, NULL, NULL); + &in_cache, &is_dirty, &is_protected, &is_pinned, NULL, NULL, NULL); if ( result < 0 ) { @@ -13662,7 +13662,7 @@ check_expunge_entry(void) result = H5C_get_entry_status(file_ptr, entry_ptr->addr, &entry_size, &in_cache, &is_dirty, &is_protected, - &is_pinned, NULL, NULL); + &is_pinned, NULL, NULL, NULL); if ( result < 0 ) { @@ -13704,7 +13704,7 @@ check_expunge_entry(void) if ( pass ) { result = H5C_get_entry_status(file_ptr, entry_ptr->addr, &entry_size, - &in_cache, &is_dirty, &is_protected, &is_pinned, NULL, NULL); + &in_cache, &is_dirty, &is_protected, &is_pinned, NULL, NULL, NULL); if ( result < 0 ) { @@ -13748,7 +13748,7 @@ check_expunge_entry(void) */ result = H5C_get_entry_status(file_ptr, entry_ptr->addr, &entry_size, - &in_cache, &is_dirty, &is_protected, &is_pinned, NULL, NULL); + &in_cache, &is_dirty, &is_protected, &is_pinned, NULL, NULL, NULL); if ( result < 0 ) { @@ -13790,7 +13790,7 @@ check_expunge_entry(void) result = H5C_get_entry_status(file_ptr, entry_ptr->addr, &entry_size, &in_cache, &is_dirty, &is_protected, - &is_pinned, NULL, NULL); + &is_pinned, NULL, NULL, NULL); if ( result < 0 ) { @@ -13833,7 +13833,7 @@ check_expunge_entry(void) result = H5C_get_entry_status(file_ptr, entry_ptr->addr, &entry_size, &in_cache, &is_dirty, &is_protected, - &is_pinned, NULL, NULL); + &is_pinned, NULL, NULL, NULL); if ( result < 0 ) { @@ -13878,7 +13878,7 @@ check_expunge_entry(void) result = H5C_get_entry_status(file_ptr, entry_ptr->addr, &entry_size, &in_cache, &is_dirty, &is_protected, - &is_pinned, NULL, NULL); + &is_pinned, NULL, NULL, NULL); if ( result < 0 ) { @@ -14832,7 +14832,7 @@ check_resize_entry(void) result = H5C_get_entry_status(file_ptr, entry_ptr->addr, &reported_entry_size, &in_cache, &is_dirty, &is_protected, &is_pinned, - NULL, NULL); + NULL, NULL, NULL); if ( result < 0 ) { @@ -14912,7 +14912,7 @@ check_resize_entry(void) result = H5C_get_entry_status(file_ptr, entry_ptr->addr, &reported_entry_size, &in_cache, &is_dirty, &is_protected, &is_pinned, - NULL, NULL); + NULL, NULL, NULL); if ( result < 0 ) { @@ -14999,7 +14999,7 @@ check_resize_entry(void) result = H5C_get_entry_status(file_ptr, entry_ptr->addr, &reported_entry_size, &in_cache, &is_dirty, &is_protected, &is_pinned, - NULL, NULL); + NULL, NULL, NULL); if ( result < 0 ) { @@ -15068,7 +15068,7 @@ check_resize_entry(void) result = H5C_get_entry_status(file_ptr, entry_ptr->addr, &reported_entry_size, &in_cache, &is_dirty, &is_protected, &is_pinned, - NULL, NULL); + NULL, NULL, NULL); if ( result < 0 ) { @@ -15129,7 +15129,7 @@ check_resize_entry(void) result = H5C_get_entry_status(file_ptr, entry_ptr->addr, &reported_entry_size, &in_cache, &is_dirty, &is_protected, &is_pinned, - NULL, NULL); + NULL, NULL, NULL); if ( result < 0 ) { @@ -15170,7 +15170,7 @@ check_resize_entry(void) result = H5C_get_entry_status(file_ptr, entry_ptr->addr, &entry_size, &in_cache, &is_dirty, &is_protected, - &is_pinned, NULL, NULL); + &is_pinned, NULL, NULL, NULL); if ( result < 0 ) { @@ -15285,7 +15285,7 @@ check_resize_entry(void) result = H5C_get_entry_status(file_ptr, entry_ptr->addr, &reported_entry_size, &in_cache, &is_dirty, &is_protected, &is_pinned, - NULL, NULL); + NULL, NULL, NULL); if ( result < 0 ) { @@ -15367,7 +15367,7 @@ check_resize_entry(void) result = H5C_get_entry_status(file_ptr, entry_ptr->addr, &reported_entry_size, &in_cache, &is_dirty, &is_protected, &is_pinned, - NULL, NULL); + NULL, NULL, NULL); if ( result < 0 ) { @@ -15454,7 +15454,7 @@ check_resize_entry(void) result = H5C_get_entry_status(file_ptr, entry_ptr->addr, &reported_entry_size, &in_cache, &is_dirty, &is_protected, &is_pinned, - NULL, NULL); + NULL, NULL, NULL); if ( result < 0 ) { @@ -15525,7 +15525,7 @@ check_resize_entry(void) result = H5C_get_entry_status(file_ptr, entry_ptr->addr, &reported_entry_size, &in_cache, &is_dirty, &is_protected, &is_pinned, - NULL, NULL); + NULL, NULL, NULL); if ( result < 0 ) { @@ -15586,7 +15586,7 @@ check_resize_entry(void) result = H5C_get_entry_status(file_ptr, entry_ptr->addr, &reported_entry_size, &in_cache, &is_dirty, &is_protected, &is_pinned, - NULL, NULL); + NULL, NULL, NULL); if ( result < 0 ) { @@ -15627,7 +15627,7 @@ check_resize_entry(void) result = H5C_get_entry_status(file_ptr, entry_ptr->addr, &entry_size, &in_cache, &is_dirty, &is_protected, - &is_pinned, NULL, NULL); + &is_pinned, NULL, NULL, NULL); if ( result < 0 ) { @@ -15925,7 +15925,7 @@ check_evictions_enabled(void) result = H5C_get_entry_status(file_ptr, entry_ptr->addr, NULL, &in_cache, NULL, NULL, NULL, - NULL, NULL); + NULL, NULL, NULL); if ( result < 0 ) { @@ -15992,7 +15992,7 @@ check_evictions_enabled(void) entry_ptr = &(base_addr[1]); result = H5C_get_entry_status(file_ptr, entry_ptr->addr, - NULL, &in_cache, NULL, NULL, NULL, NULL, NULL); + NULL, &in_cache, NULL, NULL, NULL, NULL, NULL, NULL); if ( result < 0 ) { @@ -16212,7 +16212,7 @@ check_evictions_enabled(void) entry_ptr = &(base_addr[2]); result = H5C_get_entry_status(file_ptr, entry_ptr->addr, - NULL, &in_cache, NULL, NULL, NULL, NULL, NULL); + NULL, &in_cache, NULL, NULL, NULL, NULL, NULL, NULL); if ( result < 0 ) { @@ -16248,7 +16248,7 @@ check_evictions_enabled(void) entry_ptr = &(base_addr[3]); result = H5C_get_entry_status(file_ptr, entry_ptr->addr, - NULL, &in_cache, NULL, NULL, NULL, NULL, NULL); + NULL, &in_cache, NULL, NULL, NULL, NULL, NULL, NULL); if ( result < 0 ) { @@ -16383,7 +16383,7 @@ check_evictions_enabled(void) entry_ptr = &(base_addr[4]); result = H5C_get_entry_status(file_ptr, entry_ptr->addr, - NULL, &in_cache, NULL, NULL, NULL, NULL, NULL); + NULL, &in_cache, NULL, NULL, NULL, NULL, NULL, NULL); if ( result < 0 ) { @@ -18025,7 +18025,7 @@ static void test_rpt_fcn(UNUSED H5C_t * cache_ptr, } static unsigned -check_auto_cache_resize(void) +check_auto_cache_resize(hbool_t cork_ageout) { const char * fcn_name = "check_auto_cache_resize()"; hbool_t show_progress = FALSE; @@ -19016,6 +19016,8 @@ check_auto_cache_resize(void) if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); + if(cork_ageout) + cork_entry_type(file_ptr, MEDIUM_ENTRY_TYPE); /* fill the cache with 1024 byte entries -- nothing should happen * for three epochs while the markers are inserted into the cache * @@ -19359,6 +19361,9 @@ check_auto_cache_resize(void) if ( show_progress ) HDfprintf(stderr, "check point %d\n", checkpoint++); + if(cork_ageout) + uncork_entry_type(file_ptr, MEDIUM_ENTRY_TYPE); + /* repeat the above test, but with max_decrement enabled to see * if that features works as it should. Note that this will change @@ -29527,7 +29532,7 @@ check_flush_deps(void) /* Check the parent's entry status */ entry_ptr = &(base_addr[1]); if(H5C_get_entry_status(file_ptr, entry_ptr->addr, NULL, &in_cache, - NULL, NULL, NULL, &is_flush_dep_parent, &is_flush_dep_child) < 0) + NULL, NULL, NULL, NULL, &is_flush_dep_parent, &is_flush_dep_child) < 0) CACHE_ERROR("H5C_get_entry_status() failed") if(!in_cache || is_flush_dep_parent || is_flush_dep_child) CACHE_ERROR("invalid entry status") @@ -29535,7 +29540,7 @@ check_flush_deps(void) /* Check the child's entry status */ entry_ptr = &(base_addr[0]); if(H5C_get_entry_status(file_ptr, entry_ptr->addr, NULL, &in_cache, - NULL, NULL, NULL, &is_flush_dep_parent, &is_flush_dep_child) < 0) + NULL, NULL, NULL, NULL, &is_flush_dep_parent, &is_flush_dep_child) < 0) CACHE_ERROR("H5C_get_entry_status() failed") if(!in_cache || is_flush_dep_parent || is_flush_dep_child) CACHE_ERROR("invalid entry status") @@ -29546,7 +29551,7 @@ check_flush_deps(void) /* Check the parent's entry status */ entry_ptr = &(base_addr[1]); if(H5C_get_entry_status(file_ptr, entry_ptr->addr, NULL, &in_cache, - NULL, NULL, NULL, &is_flush_dep_parent, &is_flush_dep_child) < 0) + NULL, NULL, NULL, NULL, &is_flush_dep_parent, &is_flush_dep_child) < 0) CACHE_ERROR("H5C_get_entry_status() failed") if(!in_cache || !is_flush_dep_parent || is_flush_dep_child) CACHE_ERROR("invalid entry status") @@ -29554,7 +29559,7 @@ check_flush_deps(void) /* Check the child's entry status */ entry_ptr = &(base_addr[0]); if(H5C_get_entry_status(file_ptr, entry_ptr->addr, NULL, &in_cache, - NULL, NULL, NULL, &is_flush_dep_parent, &is_flush_dep_child) < 0) + NULL, NULL, NULL, NULL, &is_flush_dep_parent, &is_flush_dep_child) < 0) CACHE_ERROR("H5C_get_entry_status() failed") if(!in_cache || is_flush_dep_parent || !is_flush_dep_child) CACHE_ERROR("invalid entry status") @@ -34978,7 +34983,8 @@ main(void) nerrs += check_unprotect_ro_dirty_err(); nerrs += check_protect_ro_rw_err(); nerrs += check_check_evictions_enabled_err(); - nerrs += check_auto_cache_resize(); + nerrs += check_auto_cache_resize(FALSE); + nerrs += check_auto_cache_resize(TRUE); nerrs += check_auto_cache_resize_disable(); nerrs += check_auto_cache_resize_epoch_markers(); nerrs += check_auto_cache_resize_input_errs(); diff --git a/test/cache_common.c b/test/cache_common.c index f9013d3..a801286 100644 --- a/test/cache_common.c +++ b/test/cache_common.c @@ -3032,6 +3032,45 @@ cork_entry_type(H5F_t * file_ptr, int32_t type) /*------------------------------------------------------------------------- + * Function: uncork_entry_type() + * + * Purpose: To "uncork" an object: + * --insert the base address of an entry type into + * the cache's list of corked object addresses + * + * Return: void + * + * Programmer: Vailin Choi; Jan 2014 + * + *------------------------------------------------------------------------- + */ +void +uncork_entry_type(H5F_t * file_ptr, int32_t type) +{ + H5C_t * cache_ptr; + haddr_t baddrs; + herr_t result; + + if(pass) { + cache_ptr = file_ptr->shared->cache; + + HDassert( cache_ptr ); + HDassert( ( 0 <= type ) && ( type < NUMBER_OF_ENTRY_TYPES ) ); + + baddrs = base_addrs[type]; + + result = H5C_cork(cache_ptr, baddrs, H5C__UNCORK, NULL); + if(result < 0) { + + pass = FALSE; + failure_mssg = "error in H5C_cork()."; + } + } + return; +} /* uncork_entry_type() */ + + +/*------------------------------------------------------------------------- * Function: insert_entry() * * Purpose: Insert the entry indicated by the type and index. diff --git a/test/cache_common.h b/test/cache_common.h index 2b110c9..04f0232 100644 --- a/test/cache_common.h +++ b/test/cache_common.h @@ -613,6 +613,8 @@ void create_pinned_entry_dependency(H5F_t * file_ptr, void reset_entries(void); void cork_entry_type(H5F_t * file_ptr, int32_t type); +void uncork_entry_type(H5F_t * file_ptr, int32_t type); + void resize_entry(H5F_t * file_ptr, -- cgit v0.12