summaryrefslogtreecommitdiff
path: root/slab_automove_extstore.c
diff options
context:
space:
mode:
authordormando <dormando@rydia.net>2022-08-22 13:02:39 -0700
committerdormando <dormando@rydia.net>2022-08-25 20:43:32 -0700
commit15ff009464a66c3cc7d5f767a51117874aac9731 (patch)
treeaef12066882b281aa55590da27f10baca32f2993 /slab_automove_extstore.c
parent7b7ffaecf6ab0b21829664f4b2ef4366926abc33 (diff)
downloadmemcached-15ff009464a66c3cc7d5f767a51117874aac9731.tar.gz
slab: use latest data in summary window
ref: #884
Diffstat (limited to 'slab_automove_extstore.c')
-rw-r--r--slab_automove_extstore.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/slab_automove_extstore.c b/slab_automove_extstore.c
index 1020983..d3f3396 100644
--- a/slab_automove_extstore.c
+++ b/slab_automove_extstore.c
@@ -153,10 +153,7 @@ void slab_automove_extstore_run(void *arg, int *src, int *dst) {
bool small_slab = a->sam_before[n].chunk_size < a->item_size
? true : false;
struct window_data *wd = get_window_data(a, n);
- // summarize the window-up-to-now.
- memset(&w_sum, 0, sizeof(struct window_data));
int w_offset = n * a->window_size;
- window_sum(&a->window_data[w_offset], &w_sum, a->window_size);
memset(wd, 0, sizeof(struct window_data));
unsigned int free_target = a->sam_after[n].chunks_per_page * MIN_PAGES_FREE;
@@ -179,6 +176,10 @@ void slab_automove_extstore_run(void *arg, int *src, int *dst) {
// set age into window
wd->age = a->iam_after[n].age;
+ // summarize the window-up-to-now.
+ memset(&w_sum, 0, sizeof(struct window_data));
+ window_sum(&a->window_data[w_offset], &w_sum, a->window_size);
+
// grab age as average of window total
uint64_t age = w_sum.age / a->window_size;