Commit f92c8dd7 authored by Bob Peterson's avatar Bob Peterson Committed by David Teigland

dlm: reduce cond_resched during send

Calling cond_resched() after every send can unnecessarily
degrade performance.  Go back to an old method of scheduling
after 25 messages.
Signed-off-by: default avatarBob Peterson <rpeterso@redhat.com>
Signed-off-by: default avatarDavid Teigland <teigland@redhat.com>
parent cb2d45da
...@@ -63,6 +63,9 @@ ...@@ -63,6 +63,9 @@
#define NEEDED_RMEM (4*1024*1024) #define NEEDED_RMEM (4*1024*1024)
#define CONN_HASH_SIZE 32 #define CONN_HASH_SIZE 32
/* Number of messages to send before rescheduling */
#define MAX_SEND_MSG_COUNT 25
struct cbuf { struct cbuf {
unsigned int base; unsigned int base;
unsigned int len; unsigned int len;
...@@ -1318,6 +1321,7 @@ static void send_to_sock(struct connection *con) ...@@ -1318,6 +1321,7 @@ static void send_to_sock(struct connection *con)
const int msg_flags = MSG_DONTWAIT | MSG_NOSIGNAL; const int msg_flags = MSG_DONTWAIT | MSG_NOSIGNAL;
struct writequeue_entry *e; struct writequeue_entry *e;
int len, offset; int len, offset;
int count = 0;
mutex_lock(&con->sock_mutex); mutex_lock(&con->sock_mutex);
if (con->sock == NULL) if (con->sock == NULL)
...@@ -1355,8 +1359,12 @@ static void send_to_sock(struct connection *con) ...@@ -1355,8 +1359,12 @@ static void send_to_sock(struct connection *con)
if (ret <= 0) if (ret <= 0)
goto send_error; goto send_error;
} }
/* Don't starve people filling buffers */
/* Don't starve people filling buffers */
if (++count >= MAX_SEND_MSG_COUNT) {
cond_resched(); cond_resched();
count = 0;
}
spin_lock(&con->writequeue_lock); spin_lock(&con->writequeue_lock);
e->offset += ret; e->offset += ret;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment