MINOR: pool: remove the size field from pool_cache_head
Everywhere we have access to the pool so we don't need to cache a copy
of the pool's size into the pool_cache_head. Let's remove it.
diff --git a/include/haproxy/pool-t.h b/include/haproxy/pool-t.h
index b6d4d31..7dc99c1 100644
--- a/include/haproxy/pool-t.h
+++ b/include/haproxy/pool-t.h
@@ -84,7 +84,6 @@
struct pool_cache_head {
struct list list; /* head of objects in this pool */
- size_t size; /* size of an object */
unsigned int count; /* number of objects in this pool */
} THREAD_ALIGNED(64);
diff --git a/include/haproxy/pool.h b/include/haproxy/pool.h
index ee97135..526c57c 100644
--- a/include/haproxy/pool.h
+++ b/include/haproxy/pool.h
@@ -94,7 +94,7 @@
item = LIST_NEXT(&ph->list, typeof(item), by_pool);
ph->count--;
- pool_cache_bytes -= ph->size;
+ pool_cache_bytes -= pool->size;
pool_cache_count--;
LIST_DEL(&item->by_pool);
LIST_DEL(&item->by_lru);
@@ -117,7 +117,7 @@
LIST_ADD(&ti->pool_lru_head, &item->by_lru);
ph->count++;
pool_cache_count++;
- pool_cache_bytes += ph->size;
+ pool_cache_bytes += pool->size;
if (unlikely(pool_cache_bytes > CONFIG_HAP_POOL_CACHE_SIZE))
pool_evict_from_cache();
diff --git a/src/pool.c b/src/pool.c
index 4f367d0..6f19ec7 100644
--- a/src/pool.c
+++ b/src/pool.c
@@ -111,7 +111,6 @@
/* update per-thread pool cache if necessary */
for (thr = 0; thr < MAX_THREADS; thr++) {
LIST_INIT(&pool->cache[thr].list);
- pool->cache[thr].size = size;
}
#endif
HA_SPIN_INIT(&pool->lock);
@@ -141,7 +140,7 @@
LIST_DEL(&item->by_lru);
ph->count--;
pool_cache_count--;
- pool_cache_bytes -= ph->size;
+ pool_cache_bytes -= pool->size;
__pool_free(pool, item);
} while (pool_cache_bytes > CONFIG_HAP_POOL_CACHE_SIZE * 7 / 8);
}