Commit abde9cc6 authored by Lars Ellenberg's avatar Lars Ellenberg Committed by Jens Axboe

drbd: Improve asender performance

Shorten receive path in the asender thread. Reduces CPU utilisation
of asender when receiving packets, and with that increases IOPs.
Signed-off-by: default avatarPhilipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: default avatarLars Ellenberg <lars.ellenberg@linbit.com>
Signed-off-by: default avatarJens Axboe <axboe@fb.com>
parent b47a06d1
...@@ -5561,6 +5561,7 @@ int drbd_asender(struct drbd_thread *thi) ...@@ -5561,6 +5561,7 @@ int drbd_asender(struct drbd_thread *thi)
* rv < expected: "woken" by signal during receive * rv < expected: "woken" by signal during receive
* rv == 0 : "connection shut down by peer" * rv == 0 : "connection shut down by peer"
*/ */
received_more:
if (likely(rv > 0)) { if (likely(rv > 0)) {
received += rv; received += rv;
buf += rv; buf += rv;
...@@ -5636,6 +5637,11 @@ int drbd_asender(struct drbd_thread *thi) ...@@ -5636,6 +5637,11 @@ int drbd_asender(struct drbd_thread *thi)
expect = header_size; expect = header_size;
cmd = NULL; cmd = NULL;
} }
if (test_bit(SEND_PING, &connection->flags))
continue;
rv = drbd_recv_short(connection->meta.socket, buf, expect-received, MSG_DONTWAIT);
if (rv > 0)
goto received_more;
} }
if (0) { if (0) {
......
...@@ -1994,22 +1994,13 @@ static bool dequeue_work_batch(struct drbd_work_queue *queue, struct list_head * ...@@ -1994,22 +1994,13 @@ static bool dequeue_work_batch(struct drbd_work_queue *queue, struct list_head *
return !list_empty(work_list); return !list_empty(work_list);
} }
static bool dequeue_work_item(struct drbd_work_queue *queue, struct list_head *work_list)
{
spin_lock_irq(&queue->q_lock);
if (!list_empty(&queue->q))
list_move(queue->q.next, work_list);
spin_unlock_irq(&queue->q_lock);
return !list_empty(work_list);
}
static void wait_for_work(struct drbd_connection *connection, struct list_head *work_list) static void wait_for_work(struct drbd_connection *connection, struct list_head *work_list)
{ {
DEFINE_WAIT(wait); DEFINE_WAIT(wait);
struct net_conf *nc; struct net_conf *nc;
int uncork, cork; int uncork, cork;
dequeue_work_item(&connection->sender_work, work_list); dequeue_work_batch(&connection->sender_work, work_list);
if (!list_empty(work_list)) if (!list_empty(work_list))
return; return;
......
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