Skip to content

Commit 1b2a5f3

Browse files
Hans Westgaard Ryjfvogel
authored andcommitted
RDS-IB: Fix cache-allocation statistics
RDS-IB collect statistics for cache-allocation visible via rds-info -v. The statistics should count allocations from cache and deallcations back to cache. Orabug: 33426206 Fixes: 91df280 ("rds: Change caching strategy for receive buffers") Signed-off-by: Hans Westgaard Ry <[email protected]> Reviewed-by: William Kucharski <[email protected]>
1 parent c86249f commit 1b2a5f3

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

net/rds/ib_recv.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ static void rds_ib_frag_free(struct rds_ib_connection *ic,
142142
ic->i_frag_cache_inx,
143143
1);
144144

145-
atomic_add(ic->i_frag_sz / 1024, &ic->i_cache_allocs);
145+
atomic_sub(ic->i_frag_sz / 1024, &ic->i_cache_allocs);
146146
rds_ib_stats_inc(s_ib_recv_nmb_added_to_cache);
147147
rds_ib_stats_add(s_ib_recv_added_to_cache, ic->i_frag_sz);
148148
}
@@ -187,7 +187,7 @@ void rds_ib_inc_free(struct rds_incoming *inc)
187187
if (p_frag)
188188
lfstack_link(&p_frag->f_cache_entry, &frag->f_cache_entry);
189189

190-
atomic_add(ic->i_frag_sz / 1024, &ic->i_cache_allocs);
190+
atomic_sub(ic->i_frag_sz / 1024, &ic->i_cache_allocs);
191191
rds_ib_stats_add(s_ib_recv_nmb_added_to_cache, count);
192192
rds_ib_stats_add(s_ib_recv_added_to_cache, ic->i_frag_sz);
193193

@@ -267,11 +267,12 @@ static struct rds_page_frag *rds_ib_refill_one_frag(struct rds_ib_connection *ic
267267
int i;
268268
int j;
269269

270+
atomic_add(ic->i_frag_sz / 1024, &ic->i_cache_allocs);
271+
270272
cache_item = rds_ib_recv_cache_get(ic->rds_ibdev->i_cache_frags +
271273
ic->i_frag_cache_inx);
272274
if (cache_item) {
273275
frag = container_of(cache_item, struct rds_page_frag, f_cache_entry);
274-
atomic_sub(ic->i_frag_sz/1024, &ic->i_cache_allocs);
275276
rds_ib_stats_inc(s_ib_recv_nmb_removed_from_cache);
276277
rds_ib_stats_add(s_ib_recv_removed_from_cache, ic->i_frag_sz);
277278
} else {

0 commit comments

Comments
 (0)