aboutsummaryrefslogtreecommitdiffstats
path: root/fs/dlm/lowcomms.c
diff options
context:
space:
mode:
authorBob Peterson <rpeterso@redhat.com>2010-11-12 12:15:20 -0500
committerDavid Teigland <teigland@redhat.com>2010-11-12 12:15:20 -0500
commitf92c8dd7a0eb18124521e2b549f88422e17f707b (patch)
treea93e644b31f9c8860a6dd513abfc0005bb602c0f /fs/dlm/lowcomms.c
parentcb2d45da81c86d5191b19d0f67732a854bc0253c (diff)
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: Bob Peterson <rpeterso@redhat.com> Signed-off-by: David Teigland <teigland@redhat.com>
Diffstat (limited to 'fs/dlm/lowcomms.c')
-rw-r--r--fs/dlm/lowcomms.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/fs/dlm/lowcomms.c b/fs/dlm/lowcomms.c
index 2bedb0ac5f92..0e75f152eac2 100644
--- a/fs/dlm/lowcomms.c
+++ b/fs/dlm/lowcomms.c
@@ -63,6 +63,9 @@
63#define NEEDED_RMEM (4*1024*1024) 63#define NEEDED_RMEM (4*1024*1024)
64#define CONN_HASH_SIZE 32 64#define CONN_HASH_SIZE 32
65 65
66/* Number of messages to send before rescheduling */
67#define MAX_SEND_MSG_COUNT 25
68
66struct cbuf { 69struct cbuf {
67 unsigned int base; 70 unsigned int base;
68 unsigned int len; 71 unsigned int len;
@@ -1318,6 +1321,7 @@ static void send_to_sock(struct connection *con)
1318 const int msg_flags = MSG_DONTWAIT | MSG_NOSIGNAL; 1321 const int msg_flags = MSG_DONTWAIT | MSG_NOSIGNAL;
1319 struct writequeue_entry *e; 1322 struct writequeue_entry *e;
1320 int len, offset; 1323 int len, offset;
1324 int count = 0;
1321 1325
1322 mutex_lock(&con->sock_mutex); 1326 mutex_lock(&con->sock_mutex);
1323 if (con->sock == NULL) 1327 if (con->sock == NULL)
@@ -1355,8 +1359,12 @@ static void send_to_sock(struct connection *con)
1355 if (ret <= 0) 1359 if (ret <= 0)
1356 goto send_error; 1360 goto send_error;
1357 } 1361 }
1358 /* Don't starve people filling buffers */ 1362
1363 /* Don't starve people filling buffers */
1364 if (++count >= MAX_SEND_MSG_COUNT) {
1359 cond_resched(); 1365 cond_resched();
1366 count = 0;
1367 }
1360 1368
1361 spin_lock(&con->writequeue_lock); 1369 spin_lock(&con->writequeue_lock);
1362 e->offset += ret; 1370 e->offset += ret;