Skip to content

Commit

Permalink
Comments on the duplicated flush and initialization to the hash table
Browse files Browse the repository at this point in the history
  • Loading branch information
SeKwonLee committed Apr 19, 2021
1 parent fddae5d commit 39c58cc
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions P-CLHT/src/clht_lb_res.c
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,8 @@ clht_create(uint64_t num_buckets)
w->ht_oldest = ht_ptr;

// This should flush everything to persistent memory
// Actually, the following flush to the buckets is unnecessary as we are using pmemobj_zalloc
// to allocate the hash table. However, we just leave the flush for a reference
clflush((char *)clht_ptr_from_off(ht_ptr->table_off, true), num_buckets * sizeof(bucket_t), false, true);
clflush((char *)ht_ptr, sizeof(clht_hashtable_t), false, true);
clflush((char *)w, sizeof(clht_t), false, true);
Expand Down Expand Up @@ -313,6 +315,9 @@ clht_hashtable_create(uint64_t num_buckets)
fprintf(stderr, "cacheline-unaligned hash table allocation\n");
}

// Note that in practice, the initializing procedures from 320 to 325 are unnecessary
// since we are allocating the hash table using pmemobj_zalloc. However, we leave those
// for a reference.
uint64_t i;
for (i = 0; i < num_buckets; i++) {
bucket_ptr[i].lock = LOCK_FREE;
Expand Down

0 comments on commit 39c58cc

Please sign in to comment.