From: Venkat Venkatsubra Date: Thu, 17 Jan 2019 14:02:23 +0000 (-0800) Subject: net/rds: ib: Fix endless RNR Retries caused by memory allocation failures X-Git-Tag: v4.1.12-124.31.3~296 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=f80ead9d446d6afe1d66be1203be2c0cf4e1db8c;p=users%2Fjedix%2Flinux-maple.git net/rds: ib: Fix endless RNR Retries caused by memory allocation failures Temporary memory allocation failures may cause an RDS connection to be stuck in an endless RNR (receiver Not Ready). Right around the time the RDS connection becomes stuck, it reports these recv buffer allocation failures: rcuos/10: page allocation failure: order:2, mode:0x2 Call Trace: [] dump_stack+0x63/0x83 [] warn_alloc_failed+0xea/0x140 [] ? select_idle_sibling+0x2a/0x120 [] __alloc_pages_slowpath+0x409/0x760 [] __alloc_pages_nodemask+0x2b1/0x2d0 [] ? check_preempt_wakeup+0x112/0x230 [] alloc_pages_current+0xaf/0x170 [] rds_page_remainder_alloc+0x60/0x2a4 [] rds_ib_refill_one_frag+0x13c/0x200 [rds_rdma] [] rds_ib_recv_refill_one+0x8d/0x220 [] rds_ib_recv_refill+0x11f/0x340 [rds_rdma] [] rds_ib_recv_cqe_handler+0x23e/0x290 [] poll_cq+0x66/0xe0 [rds_rdma] [] rds_ib_rx+0xbd/0x210 [rds_rdma] [] rds_ib_tasklet_fn_recv+0x3a/0x50 [rds_rdma] [] tasklet_action+0xb1/0xc0 [] __do_softirq+0x10a/0x350 [] do_softirq_own_stack+0x1c/0x30 [] do_softirq+0x55/0x60 [] __local_bh_enable_ip+0x88/0x90 [] rcu_nocb_kthread+0xf1/0x180 [] ? print_cpu_stall+0x170/0x170 [] ? print_cpu_stall+0x170/0x170 [] kthread+0xce/0xf0 [] ? kthread_freezable_should_stop+0x70/0x70 [] ret_from_fork+0x42/0x70 [] ? kthread_freezable_should_stop+0x70/0x70 We re-schedule recv buffer refiller on satisfying these conditions: if (rds_conn_up(conn) && (must_wake || (can_wait && ring_low) || rds_ib_ring_empty(&ic->i_recv_ring))) { queue_delayed_work(conn->c_wq, &conn->c_recv_w, 1); } This currently doesn't take into account memory allocation failures. A bit later the memory pressure clears away. But RDS does not refill receive buffers for that connection any more. This is because the receiver is only woken up on the last packet of a multi-packet message. But the last packet is never received, because the recv queue becomes empty and we end up in the endless RNR Retry situation. Orabug: 28127993 Consultation with: Haakon Bugge Reviewed-by: Yanjun Zhu Reviewed-by: Haakon Bugge Signed-off-by: Venkat Venkatsubra Signed-off-by: Brian Maly --- diff --git a/net/rds/ib_recv.c b/net/rds/ib_recv.c index c0fb3cf3b947..4c05ae7e6f97 100644 --- a/net/rds/ib_recv.c +++ b/net/rds/ib_recv.c @@ -691,8 +691,10 @@ void rds_ib_recv_refill(struct rds_connection *conn, int prefill, gfp_t gfp) recv = &ic->i_recvs[pos]; ret = rds_ib_recv_refill_one(conn, recv, gfp); - if (ret) + if (ret) { + must_wake = 1; break; + } for_each_sg(recv->r_frag->f_sg, sg, ic->i_frag_pages, i) rdsdebug("recv %p ibinc %p page %p addr %lu\n", recv,