From 744b6b282f087ce23310805dc24ce8f8b351fb61 Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Sat, 30 Sep 2017 09:50:58 -0500 Subject: Better segregate clean & dirty LRU lists so that they are only defined when the H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS macro is defined. --- src/H5C.c | 8 ++++++++ src/H5Cdbg.c | 2 ++ src/H5Cimage.c | 2 ++ src/H5Cpkg.h | 2 ++ src/H5Cprivate.h | 2 ++ test/cache.c | 9 +++++---- test/cache_common.c | 2 ++ 7 files changed, 23 insertions(+), 4 deletions(-) diff --git a/src/H5C.c b/src/H5C.c index 926d3fd..0d8cc75 100644 --- a/src/H5C.c +++ b/src/H5C.c @@ -366,6 +366,7 @@ H5C_create(size_t max_cache_size, cache_ptr->coll_write_list = NULL; #endif /* H5_HAVE_PARALLEL */ +#if H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS cache_ptr->cLRU_list_len = 0; cache_ptr->cLRU_list_size = (size_t)0; cache_ptr->cLRU_head_ptr = NULL; @@ -375,6 +376,7 @@ H5C_create(size_t max_cache_size, cache_ptr->dLRU_list_size = (size_t)0; cache_ptr->dLRU_head_ptr = NULL; cache_ptr->dLRU_tail_ptr = NULL; +#endif /* H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS */ cache_ptr->size_increase_possible = FALSE; cache_ptr->flash_size_increase_possible = FALSE; @@ -1481,8 +1483,10 @@ H5C_insert_entry(H5F_t * f, entry_ptr->next = NULL; entry_ptr->prev = NULL; +#if H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS entry_ptr->aux_next = NULL; entry_ptr->aux_prev = NULL; +#endif /* H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS */ #ifdef H5_HAVE_PARALLEL entry_ptr->coll_next = NULL; @@ -6949,8 +6953,10 @@ H5C_load_entry(H5F_t * f, entry->next = NULL; entry->prev = NULL; +#if H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS entry->aux_next = NULL; entry->aux_prev = NULL; +#endif /* H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS */ #ifdef H5_HAVE_PARALLEL entry->coll_next = NULL; @@ -7285,6 +7291,7 @@ H5C__make_space_in_cache(H5F_t *f, hid_t dxpl_id, size_t space_needed, HDassert( H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS ); +#if H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS initial_list_len = cache_ptr->cLRU_list_len; entry_ptr = cache_ptr->cLRU_tail_ptr; @@ -7329,6 +7336,7 @@ H5C__make_space_in_cache(H5F_t *f, hid_t dxpl_id, size_t space_needed, entry_ptr = prev_ptr; entries_examined++; } +#endif /* H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS */ } done: diff --git a/src/H5Cdbg.c b/src/H5Cdbg.c index 4a08d9b..08c70d9 100644 --- a/src/H5Cdbg.c +++ b/src/H5Cdbg.c @@ -716,6 +716,7 @@ H5C_stats(H5C_t * cache_ptr, (long)(cache_ptr->LRU_list_size), (unsigned long)(cache_ptr->LRU_list_len)); +#if H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS HDfprintf(stdout, "%s current clean LRU size / length = %ld / %lu\n", cache_ptr->prefix, @@ -727,6 +728,7 @@ H5C_stats(H5C_t * cache_ptr, cache_ptr->prefix, (long)(cache_ptr->dLRU_list_size), (unsigned long)(cache_ptr->dLRU_list_len)); +#endif /* H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS */ HDfprintf(stdout, "%s Total hits / misses / hit_rate = %ld / %ld / %f\n", diff --git a/src/H5Cimage.c b/src/H5Cimage.c index debd30c..53d1712 100644 --- a/src/H5Cimage.c +++ b/src/H5Cimage.c @@ -649,8 +649,10 @@ H5C__deserialize_prefetched_entry(H5F_t *f, hid_t dxpl_id, H5C_t *cache_ptr, /* Initialize fields supporting replacement policies: */ ds_entry_ptr->next = NULL; ds_entry_ptr->prev = NULL; +#if H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS ds_entry_ptr->aux_next = NULL; ds_entry_ptr->aux_prev = NULL; +#endif /* H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS */ #ifdef H5_HAVE_PARALLEL pf_entry_ptr->coll_next = NULL; pf_entry_ptr->coll_prev = NULL; diff --git a/src/H5Cpkg.h b/src/H5Cpkg.h index fdb14a5..d431887 100644 --- a/src/H5Cpkg.h +++ b/src/H5Cpkg.h @@ -4746,6 +4746,7 @@ struct H5C_t { H5C_cache_entry_t * LRU_head_ptr; H5C_cache_entry_t * LRU_tail_ptr; +#if H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS /* Fields for clean LRU list of entries */ uint32_t cLRU_list_len; size_t cLRU_list_size; @@ -4757,6 +4758,7 @@ struct H5C_t { size_t dLRU_list_size; H5C_cache_entry_t * dLRU_head_ptr; H5C_cache_entry_t * dLRU_tail_ptr; +#endif /* H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS */ #ifdef H5_HAVE_PARALLEL /* Fields for collective metadata reads */ diff --git a/src/H5Cprivate.h b/src/H5Cprivate.h index 5335f80..50732ca 100644 --- a/src/H5Cprivate.h +++ b/src/H5Cprivate.h @@ -1648,8 +1648,10 @@ typedef struct H5C_cache_entry_t { /* fields supporting replacement policies: */ struct H5C_cache_entry_t *next; struct H5C_cache_entry_t *prev; +#if H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS struct H5C_cache_entry_t *aux_next; struct H5C_cache_entry_t *aux_prev; +#endif /* H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS */ #ifdef H5_HAVE_PARALLEL struct H5C_cache_entry_t *coll_next; struct H5C_cache_entry_t *coll_prev; diff --git a/test/cache.c b/test/cache.c index 3df8156..97a1b91 100644 --- a/test/cache.c +++ b/test/cache.c @@ -3116,13 +3116,14 @@ check_insert_entry(unsigned paged) (cache_ptr->pel_len != 2) || (cache_ptr->pel_size != 2 * entry_sizes[entry_type]) || (cache_ptr->LRU_list_len != 2) || - (cache_ptr->LRU_list_size != 2 * entry_sizes[entry_type]) || + (cache_ptr->LRU_list_size != 2 * entry_sizes[entry_type]) #if H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS - (cache_ptr->dLRU_list_len != 2) || + || (cache_ptr->dLRU_list_len != 2) || (cache_ptr->dLRU_list_size != 2 * entry_sizes[entry_type]) || -#endif /* H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS */ (cache_ptr->cLRU_list_len != 0) || - (cache_ptr->cLRU_list_size != (size_t)0)) { + (cache_ptr->cLRU_list_size != (size_t)0) +#endif /* H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS */ + ) { pass = FALSE; failure_mssg = "Unexpected insert results 10."; diff --git a/test/cache_common.c b/test/cache_common.c index 69bc26a..cadccec 100644 --- a/test/cache_common.c +++ b/test/cache_common.c @@ -2436,8 +2436,10 @@ reset_entries(void) base_addr[j].header.ro_ref_count = FALSE; base_addr[j].header.next = NULL; base_addr[j].header.prev = NULL; +#if H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS base_addr[j].header.aux_next = NULL; base_addr[j].header.aux_prev = NULL; +#endif /* H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS */ base_addr[j].self = &(base_addr[j]); base_addr[j].cache_ptr = NULL; -- cgit v0.12