Skip to content

Commit 873a78a

Browse files
Hakon-Buggegerd-rausch
authored andcommitted
net/rds: ib: Release correct number of frags
Commit c682e8474bd4 ("net/rds: reduce memory footprint during ib_post_recv in IB transport") introduces an SG list instead of a single contiguously fragment. When rebuilding the caches, it attempts to release the number of fragments used by the new connection, independent of the actual number of fragments used by the cache. This leads to a kernel crash. Instead, release the correct number of fragments. Orabug: 27902555 Signed-off-by: Håkon Bugge <[email protected]> Reviewed-by: Zhu Yanjun <[email protected]> Reviewed-by: Ka-Cheong Poon <[email protected]> Acked-by: Santosh Shilimkar <[email protected]>
1 parent f3f644b commit 873a78a

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

net/rds/ib_recv.c

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -207,13 +207,16 @@ void rds_ib_recv_free_caches(struct rds_ib_connection *ic)
207207
free_percpu(ic->i_cache_frags.percpu);
208208

209209
list_for_each_entry_safe(frag, frag_tmp, &list, f_cache_entry) {
210+
int cache_frag_pages = ceil(ic->i_frag_cache_sz, PAGE_SIZE);
211+
210212
list_del(&frag->f_cache_entry);
211213
WARN_ON(!list_empty(&frag->f_item));
212-
rds_ib_recv_free_frag(frag, ic->i_frag_pages);
213-
atomic_sub(ic->i_frag_pages, &rds_ib_allocation);
214+
rds_ib_recv_free_frag(frag, cache_frag_pages);
215+
atomic_sub(cache_frag_pages, &rds_ib_allocation);
214216
kmem_cache_free(rds_ib_frag_slab, frag);
215-
atomic_sub(ic->i_frag_sz / 1024, &ic->i_cache_allocs);
216-
rds_ib_stats_add(s_ib_recv_removed_from_cache, ic->i_frag_sz);
217+
atomic_sub(ic->i_frag_cache_sz / 1024, &ic->i_cache_allocs);
218+
rds_ib_stats_add(s_ib_recv_removed_from_cache, ic->i_frag_cache_sz);
219+
217220
}
218221
}
219222

0 commit comments

Comments
 (0)