Skip to content

Commit

Permalink
Merge branch 'rds-next'
Browse files Browse the repository at this point in the history
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 <davem@davemloft.net>
  • Loading branch information
David S. Miller committed Aug 15, 2019
2 parents 907389b + 11740ef commit 4b58c9b
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 3 deletions.
2 changes: 1 addition & 1 deletion net/rds/af_rds.c
Original file line number Diff line number Diff line change
Expand Up @@ -705,7 +705,7 @@ static int rds_create(struct net *net, struct socket *sock, int protocol,
if (sock->type != SOCK_SEQPACKET || protocol)
return -ESOCKTNOSUPPORT;

sk = sk_alloc(net, AF_RDS, GFP_ATOMIC, &rds_proto, kern);
sk = sk_alloc(net, AF_RDS, GFP_KERNEL, &rds_proto, kern);
if (!sk)
return -ENOMEM;

Expand Down
12 changes: 11 additions & 1 deletion net/rds/ib_recv.c
Original file line number Diff line number Diff line change
Expand Up @@ -385,6 +385,7 @@ void rds_ib_recv_refill(struct rds_connection *conn, int prefill, gfp_t gfp)
unsigned int posted = 0;
int ret = 0;
bool can_wait = !!(gfp & __GFP_DIRECT_RECLAIM);
bool must_wake = false;
u32 pos;

/* the goal here is to just make sure that someone, somewhere
Expand All @@ -405,6 +406,7 @@ 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) {
must_wake = true;
break;
}

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

posted++;

if ((posted > 128 && need_resched()) || posted > 8192) {
must_wake = true;
break;
}
}

/* We're doing flow control - update the window. */
Expand All @@ -445,10 +452,13 @@ void rds_ib_recv_refill(struct rds_connection *conn, int prefill, gfp_t gfp)
* if we should requeue.
*/
if (rds_conn_up(conn) &&
((can_wait && rds_ib_ring_low(&ic->i_recv_ring)) ||
(must_wake ||
(can_wait && rds_ib_ring_low(&ic->i_recv_ring)) ||
rds_ib_ring_empty(&ic->i_recv_ring))) {
queue_delayed_work(rds_wq, &conn->c_recv_w, 1);
}
if (can_wait)
cond_resched();
}

/*
Expand Down
2 changes: 1 addition & 1 deletion net/rds/rds.h
Original file line number Diff line number Diff line change
Expand Up @@ -717,7 +717,7 @@ struct rds_statistics {
uint64_t s_cong_send_blocked;
uint64_t s_recv_bytes_added_to_socket;
uint64_t s_recv_bytes_removed_from_socket;

uint64_t s_send_stuck_rm;
};

/* af_rds.c */
Expand Down
12 changes: 12 additions & 0 deletions net/rds/send.c
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ int rds_send_xmit(struct rds_conn_path *cp)
LIST_HEAD(to_be_dropped);
int batch_count;
unsigned long send_gen = 0;
int same_rm = 0;

restart:
batch_count = 0;
Expand Down Expand Up @@ -200,6 +201,17 @@ int rds_send_xmit(struct rds_conn_path *cp)

rm = cp->cp_xmit_rm;

if (!rm) {
same_rm = 0;
} else {
same_rm++;
if (same_rm >= 4096) {
rds_stats_inc(s_send_stuck_rm);
ret = -EAGAIN;
break;
}
}

/*
* If between sending messages, we can send a pending congestion
* map update.
Expand Down
3 changes: 3 additions & 0 deletions net/rds/stats.c
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,9 @@ static const char *const rds_stat_names[] = {
"cong_update_received",
"cong_send_error",
"cong_send_blocked",
"recv_bytes_added_to_sock",
"recv_bytes_freed_fromsock",
"send_stuck_rm",
};

void rds_stats_info_copy(struct rds_info_iterator *iter,
Expand Down

0 comments on commit 4b58c9b

Please sign in to comment.