Skip to content

Commit 4b58c9b

Browse files
committed
Merge branch 'rds-next'
Gerd Rausch says: ==================== net/rds: Fixes from internal Oracle repo This is the first set of (mostly old) patches from our internal repository in an effort to synchronize what Oracle had been using internally with what is shipped with the Linux kernel. ==================== Signed-off-by: David S. Miller <[email protected]>
2 parents 907389b + 11740ef commit 4b58c9b

File tree

5 files changed

+28
-3
lines changed

5 files changed

+28
-3
lines changed

net/rds/af_rds.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -705,7 +705,7 @@ static int rds_create(struct net *net, struct socket *sock, int protocol,
705705
if (sock->type != SOCK_SEQPACKET || protocol)
706706
return -ESOCKTNOSUPPORT;
707707

708-
sk = sk_alloc(net, AF_RDS, GFP_ATOMIC, &rds_proto, kern);
708+
sk = sk_alloc(net, AF_RDS, GFP_KERNEL, &rds_proto, kern);
709709
if (!sk)
710710
return -ENOMEM;
711711

net/rds/ib_recv.c

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -385,6 +385,7 @@ void rds_ib_recv_refill(struct rds_connection *conn, int prefill, gfp_t gfp)
385385
unsigned int posted = 0;
386386
int ret = 0;
387387
bool can_wait = !!(gfp & __GFP_DIRECT_RECLAIM);
388+
bool must_wake = false;
388389
u32 pos;
389390

390391
/* the goal here is to just make sure that someone, somewhere
@@ -405,6 +406,7 @@ void rds_ib_recv_refill(struct rds_connection *conn, int prefill, gfp_t gfp)
405406
recv = &ic->i_recvs[pos];
406407
ret = rds_ib_recv_refill_one(conn, recv, gfp);
407408
if (ret) {
409+
must_wake = true;
408410
break;
409411
}
410412

@@ -423,6 +425,11 @@ void rds_ib_recv_refill(struct rds_connection *conn, int prefill, gfp_t gfp)
423425
}
424426

425427
posted++;
428+
429+
if ((posted > 128 && need_resched()) || posted > 8192) {
430+
must_wake = true;
431+
break;
432+
}
426433
}
427434

428435
/* We're doing flow control - update the window. */
@@ -445,10 +452,13 @@ void rds_ib_recv_refill(struct rds_connection *conn, int prefill, gfp_t gfp)
445452
* if we should requeue.
446453
*/
447454
if (rds_conn_up(conn) &&
448-
((can_wait && rds_ib_ring_low(&ic->i_recv_ring)) ||
455+
(must_wake ||
456+
(can_wait && rds_ib_ring_low(&ic->i_recv_ring)) ||
449457
rds_ib_ring_empty(&ic->i_recv_ring))) {
450458
queue_delayed_work(rds_wq, &conn->c_recv_w, 1);
451459
}
460+
if (can_wait)
461+
cond_resched();
452462
}
453463

454464
/*

net/rds/rds.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -717,7 +717,7 @@ struct rds_statistics {
717717
uint64_t s_cong_send_blocked;
718718
uint64_t s_recv_bytes_added_to_socket;
719719
uint64_t s_recv_bytes_removed_from_socket;
720-
720+
uint64_t s_send_stuck_rm;
721721
};
722722

723723
/* af_rds.c */

net/rds/send.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,7 @@ int rds_send_xmit(struct rds_conn_path *cp)
145145
LIST_HEAD(to_be_dropped);
146146
int batch_count;
147147
unsigned long send_gen = 0;
148+
int same_rm = 0;
148149

149150
restart:
150151
batch_count = 0;
@@ -200,6 +201,17 @@ int rds_send_xmit(struct rds_conn_path *cp)
200201

201202
rm = cp->cp_xmit_rm;
202203

204+
if (!rm) {
205+
same_rm = 0;
206+
} else {
207+
same_rm++;
208+
if (same_rm >= 4096) {
209+
rds_stats_inc(s_send_stuck_rm);
210+
ret = -EAGAIN;
211+
break;
212+
}
213+
}
214+
203215
/*
204216
* If between sending messages, we can send a pending congestion
205217
* map update.

net/rds/stats.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,9 @@ static const char *const rds_stat_names[] = {
7676
"cong_update_received",
7777
"cong_send_error",
7878
"cong_send_blocked",
79+
"recv_bytes_added_to_sock",
80+
"recv_bytes_freed_fromsock",
81+
"send_stuck_rm",
7982
};
8083

8184
void rds_stats_info_copy(struct rds_info_iterator *iter,

0 commit comments

Comments
 (0)